-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Callbacks inconsistencies. #396
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
Comments
Found the underlying issue with the first problem, it is not related to The behavior is explained in I think the logic there is sound, but the unexpected behavior comes from the |
I've narrowed down the culprit for the None callbacks in By debugging, I can tell the only times it is getting called is to make those initial layout callbacks. I removed those lines and the None callbacks were gone but also those that are set by layout (eg |
Didn't bother investigating the nitty gritty of your debugging but can confirm weird things happing with I would be happy to share my code causing the problem if it would help though its few hundred lines so not a prime minimal example (but its hard for me to locate the problem like I said). |
Add Renovate Bot configuration to repo
Closing old issue, mentions old code that is no longer relevant. |
I have been having strange issues when developing new components and dash apps and I'd like to share them.
Sometimes callbacks are not called during initialization, sometimes the default prop never get applied. There are some inconsistencies with the callback system.
If a prop doesn't have a defaultProps entry, it never get an initial callback.
Also true if the default props is nil. Discovered while working on the Storage component, I initially thought that setProps didn't work in
componentWillMount
, when I added a timestamp with a default of-1
, I was getting the callback.Example to get the data props from a storage component using the timestamp on initial load:
If you click the button, then reload the page, it should show
initial
below the button.If you remove the modified_timestamp input:
It won't be called on initial load.
Add a second Input to an input list: the default props never get applied to the Inputs it stays at None.
If you only click btn2, you will always get a PreventUpdate, it also ends up missing the second initial callback.
There is two initial callbacks that can pop up, only the second is useful since the first one only have None as arguments.
I think we should remove the first callback with all
None
arguments. It has no use and only create bloat IMO because I always have a check if None then raise PreventUpdate. The only time it is useful is if you want to act on the initial layout, but if we fix the initial callback for non default props it's a non-issue.Also could be useful to have the initial values if we implement state saving for the dash-renderer redux store.
cc @plotly/dash
The text was updated successfully, but these errors were encountered: