Skip to content
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

prevent_initial_call="initial_duplicate" not working as expected #2974

Open
Lxstr opened this issue Sep 3, 2024 · 0 comments
Open

prevent_initial_call="initial_duplicate" not working as expected #2974

Lxstr opened this issue Sep 3, 2024 · 0 comments
Assignees
Labels
bug something broken P2 considered for next cycle

Comments

@Lxstr
Copy link
Contributor

Lxstr commented Sep 3, 2024

Hello!

dash==2.17.1
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-mantine-components==0.14.4

Describe the bug
I have callbacks I wish to start on load (prevent_initial_call=False) and do not care about the order of results eg. loading data and then sending dmc notification.

These are either from the same page or different pages targeting the same output. Having the ability to send from different pages helps the consistency app as the user sees notifications persist between pages.

Setting prevent_initial_call="initial_duplicate" and allow_duplicate=True results in effectively prevent_initial_Call=True. If only set to on some of the duplicate results in the following error, which says to do the thing I am already doing.

dash.exceptions.DuplicateCallback: allow_duplicate requires prevent_initial_call to be True. The order of the call is not guaranteed to be the same on every page load. To enable duplicate callback with initial call, set prevent_initial_call='initial_duplicate' or globally in the config prevent_initial_callbacks='initial_duplicate'

I also tried setting this at the global level but results in:

TypeError: Dash() got an unexpected keyword argument 'prevent_initial_callback'
Perhaps I am misunderstanding the purpose but I just want to run the callbacks with full awareness that the order is not guaranteed (desirable in this case).

The only documentation I could find is https://community.plotly.com/t/dash-2-9-2-released-partial-property-updates-with-patch-duplicate-outputs-dcc-geolocation-scatter-group-attributes-and-more/72114#allowing-duplicate-callback-outputs-7

I've attached an MRE here https://github.com/Lxstr/dash-multi-page-app-demos/tree/prevent-initial-duplicate

Thanks!

@gvwilson gvwilson changed the title [BUG] prevent_initial_call="initial_duplicate" not working as expected prevent_initial_call="initial_duplicate" not working as expected Sep 3, 2024
@gvwilson gvwilson added bug something broken P2 considered for next cycle labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

3 participants