[Feature Request] Make Pages `dcc.Location` id public?
AnnMarieW opened this issue · comments
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:
- Add your own
dcc.Location
to the app - Use
"_pages_location"
in a callback - Import the id variable name:
from dash.dash import _LOCATION_ID
- 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
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.
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