-
-
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
[BUG] Callback executes but return value has no effect #1075
Comments
Using what I posted here as a minimal example, I can get it to work properly by removing the intermediate Div and and . Instead, if I use the directly as an input for both callbacks, and use children as an input for the second callback instead of , it updates just fine. However I would expect this to work, especially since the callback fires properly, just that the return value is not registered. The reason why I split it like that at the first place is that in the full code, I was using as an input for multiple callbacks (5 total), and some would not fire at all or fire randomly when the button was pressed. Using it as an input for only one callback and using several Div to propagate the callback made the appropriate callbacks fire, but then the return values are "ignored" as described in the first post. |
Running into (I think) a similar issue with callbacks being ignored with Dash releases post 1.6.1. The callback does execute (and I can even see it correct in the network requests in the console), but does not have the intended effect on the layout. Does your example work when you use |
It may have something to do with this change (I would assume it's in the dash-renderer JS since it's making it to the client correctly): v1.6.1...v1.7.0#diff-15692ba768eeab56e95aa409ab7c19b7R370-R392 /**
* Determine the id of all components used as input or state in the callbacks
* triggered by the props change.
*
* Wait for all components associated to these ids to be ready before initiating
* the callbacks.
*/
const deps = queuedObservers.map(output =>
dependenciesRequest.content.find(
dependency => dependency.output === output
)
);
const ids = uniq(
flatten(
deps.map(dep => [
dep.inputs.map(input => input.id),
dep.state.map(state => state.id),
])
)
);
await isAppReady(layout, paths, ids); |
I suspect this will be fixed by #1103 (which includes tests for #1053 and #1071) but it's hard to tell for sure without a complete reproduction case. If one of you would be able to post a full app showing the bug I'd be happy to try it and include a test for it - or, you can try the |
Hey @alexcjohnson
|
Describe your context
dash 1.7.0
dash-core-components 1.6.0
dash-html-components 1.0.2
dash-renderer 1.2.2
dash-table 4.5.1
Tried on Google Chrome and Firefox
Describe the bug
Hi, I have an issue with a callback. It executes just fine (I can see print outs from it) but the return value has no effect.
Basically I hooked a Div with a custom class (a spinner) to a button. The div is at the beginning hidden. When the button is pressed, the callback changed the style of that div to remove "visibility" attribute. That button also trigger some operations happening on the server side, and when this operation is finished, it fills a Dash table and notify a hidden Div that the operation is finished. That hidden Div is also connected to my spinner to changed the style back to add the 'visibility': "hidden" back.
The code looks like this:
It works the first time I click on the button , but any subsequent click generate the proper table content for and triggers the callback (I can see it in the logs), but the
does't get its style changed.
The logs shows:
As you can see (hopefully), The first time the button is pressed, the current style of the Div has the "hidden" attribute. When the operation is over ("Getting messages" message), the callback is triggered again, and the current style doesn't have the hidden attribute (which is expected).
The second time around, the callback is triggered properly again, but the spinner never showed. Indeed, one can see that after the operation completes, and the current style of the div is printed, it has the "hidden" attribute while it should have been removed previously.
Expected behavior
When the callback is triggered and executed, the return value should have an effect.
I hope this is clear enough. This is taken from a big piece of code so hopefully I managed to make it readable.
The text was updated successfully, but these errors were encountered: