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

[Feature Request] Make Pages dcc.Location id public? #2708

Open
AnnMarieW opened this issue Dec 3, 2023 · 2 comments
Open

[Feature Request] Make Pages dcc.Location id public? #2708

AnnMarieW opened this issue Dec 3, 2023 · 2 comments

Comments

@AnnMarieW
Copy link
Collaborator

AnnMarieW commented Dec 3, 2023

The id of the dcc.Location component used in Pages is currently marked as non-public. However it's fairly common to see this id used in apps. Are there any issues with making the id public? What is the best practice for using dcc.Location in a Pages app?

Here are some options:

  1. Add your own dcc.Location to the app
  2. Use "_pages_location" in a callback
  3. Import the id variable name:
from dash.dash import _LOCATION_ID
  1. Create a new variable in Dash so it can be used like this:
from dash import <new variable name>

May need to update this example the docs after this is resolved

@Coding-with-Adam
Copy link

Thanks for adding this feature request, @AnnMarieW .
I've labeled it accordingly, and assigned it as priority level 2 since it's tied to another recent PR.

@antonymilne
Copy link

I just happened upon this completely by accident and it's like @AnnMarieW read my mind again 😀 This is something I wanted to use before on Vizro and ended up being torn between making my own dcc.Location (works fine but seems kind of redundant) vs. relying on the private attribute.

So definitely 👍 from me - this would be a nice quality of life improvement for many Dash pages users I think.

Option 4 looks best to me:

from dash import page_location # or page_location_id?
# Note this matches imports for page_registry, page_container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants