✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

dcc.Location search and hash callbacks are triggered twice and when they aren't necessarily being modified

I’m finding unexpected behaviour when working with dcc.Location search and hash props.
If you set a callback with any of those as Inputs, they fire callback twice every time you load or reload the app. In the first run they have None value and in second run they get their actual value.
Also, these callbacks get fired not only when those parts of the URI have been modified (namely, only the query string part or the hash part), but they are triggered every single time that the address url is modified, even if that part wasn’t modified.
To illustrate this, try this example in your local machine and see the logs from Dash when you modify parts of the url.
I’ve seen something related here: https://github.com/plotly/dash-core-components/issues/138, but my issue is that they trigger twice every time that path changes, not only on first page load and also that the callbacks regarding hash and search get fired even when those parts have not been affected.

It’s been a while since you wrote this, but I see the same.

In my case it is a real problem as I need to generate callbacks dynamically. This is possible, but since there may only be one callback per output, as dcc.Location triggers twice, the second creation stops the execution of the site code.