-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] previous state support #140
Conversation
Isn't figuring out the source of the click a more common pattern than needing the previous state? The alternative to this PR would be to pass the event emitter and event type to the callback. |
An alternative would be to allow an Output element to have multiple callbacks assigned to it. This way you can have a callback function for each input separately. Although I have no idea if this is even possible! |
It may be, but providing the previous state allows you to do both.
I'm afraid that this would cause too much ambiguity (for example, what should happen if the same input was in both outputs - would you call both callbacks or just one?) - I think that there was a discussion about this in the community forum somewhere. |
Is it guaranteed that all events are possible to get by diffing with the previous state? |
Another question: is there anything that is not possible to do if the event information is provided to the callback, as opposed to the previous state? |
My inclination is that I would also prefer the capacity to determine the origin of the Event/Input/State rather than diffing against a previous state. Even if you can achieve the desired functionality by diffing a previous state, my hunch is that targeting values based on their source component would provide a more intuitive interface. As mentioned in #159, I already find the callback function signature a bit unwieldy to keep track of arguments, and the proposed change compounds this issue. |
I have a short-term workaround for this @ned2: In this scheme, click events are all passed through their individual hidden div functions. The hidden div functions pass a timestamp which in turn is input to my primary callback. Click origins are finally determined by the most recent timestamp passed as input to the primary callback, while their content is passed as a state variable. |
Before I just close this stale PR, let me ask @chriddyp and those who've commented on this thread: now that we have an |
In some components, like Re 'determining which property has changed': For usability in the future, I think that some type of first-class "which component has changed" would be a better solution than this previous state idea, perhaps as part of a |
Thanks @chriddyp - good to know about |
…whitespace Fix word case and remove whitespace.
* Isolate css normalization so it impacts only the dash-table * increase default styling specificity * fix visual regression on delete column
* Isolate css normalization so it impacts only the dash-table * increase default styling specificity * fix visual regression on delete column
…pace Fix word case and remove whitespace.
Fix Link and Location for IE
depends on plotly/dash-renderer#25
experimental usage