-
-
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
dcc location callback nav #2068
Conversation
The PR look good. Is there an issue for the limitation:
|
This looks good to me too. As @T4rk1n says we should make sure there's an issue open regarding the browser crash scenario, and any of the other limitations we aren't addressing here. In particular:
Does that include the automatic one added by the pages skeleton? If so is the statement actually "none of the individual pages can have a
Only with
Do I have that right or is there more nuance (or things I got wrong)? Anyway none of this needs to go in this PR, but before merging we should have answers/issues for these points. And resolve the merge conflicts 😏 |
Merge conflicts are fixed Here is clarification on the use-case and limitations:
Limitations
This was reported in #1346. I added a MRE there.
Navigation can be buggy if the dcc.Location is in one of the pages rather than in app.py. Added a MRE to issue #1346
I added a minimal example in #1312 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Thanks @AnnMarieW for adding this mode, and for adding examples for the remaining buggy behavior 🎉
@LiamConnors would you look over the description @AnnMarieW posted for when to use each of these three refresh
modes #2068 (comment) and ensure they're reflected in the docs?
@alexcjohnson once @LiamConnors reviews the descriptions, should I update the docstrings for the |
Sure, that could be useful 🌟 |
Improve page navigation when
dcc.Location
is updated in a callback.Currently when dcc.Location is updated in a callback, the browser url is updated, but it does not navigate to the new page unless the browser is refreshed. This PR makes it unnecessary to refresh the browser -- giving the same fast navigation as when user clicks on a
dcc.Link
.As requested on the Dash Community Forum
Limitations
The following issues occur when there are multiple
dcc.Location
components in a multi-page app. These are all existing issues and are not new based on changes in this PR. It they aren't fixed as part of the PR, then it would be helpful to document the workarounds.There are potential conflicts when callbacks update multiple
dcc.Location
location causing the browser to crash.When using in a multi-page app with multiple
dcc.Location
components, they must all be on the same page - typically theapp.py
file. (Or theindex.py
if using the multi-page structure whereapp
is defined in it's own file)When navigating to a page with the callback to update the
dcc.Location
the callback is fired even whenprevent_initial_call=True
This has been reported in issue 1346 and issue 1985Browser forward/back doesn't work when there are multiple
dcc.Location
components.refresh="callback-nav"
to thedcc.Location
in thedash.page_container
Contributor Checklist
optionals
CHANGELOG.md
Sample usage