You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can tell, this flavor of the "duplicate dcc.Location callback" issue (#883) hasn't been documented yet. When I run a multipage app, reloading the page fires the callback twice with the samehref / pathname / search payload. This is distinct from the other issue of having the callback return None and then returning the proper value(s).
I've tried the fix mentioned in #883 (comment) to no avail. Solving this is mission critical for my app because the duplicate callback crashes a subsequent database query.
Changing href via a html.Link makes the callback fire only once. However, users need to be able to share app URLs with query params, which right now is broken due to this bug.
changed the title [-][BUG] dcc.Location callback fires twice IDENTICALLY[/-][+][BUG] dcc.Location callback fires twice IDENTICALLY when reload=False[/+]on Dec 16, 2019
changed the title [-][BUG] dcc.Location callback fires twice IDENTICALLY when reload=False[/-][+][BUG] dcc.Location callback fires twice IDENTICALLY[/+]on Dec 16, 2019
Reacted by Chabbey François, DEV Republik, Csaba Varró, Ceyhun Kerti, Emmet Murphy, Marcos Huerta, Francesco Bodria, Paulito, Drew Yang, Benn Hamer and 1 more
me too. I tried to avoid the second time execution by using a data_store flag but for some reason, as the states and inputs are exactly the same, this can't be accomplished
I am experiencing the same issue. Callback with a 'pathname' property as input is being triggered 4 times. The result is that a chart on another page takes a few seconds to appear rather than appear instantly when I click on the button for that page. Critical issue.
I'm experiencing this issue too.
Digging a bit in the source code, it seems a dash-renderer problem with some components default state.
Here is a quick fix to avoid this problem in Location component (jgoday@5681290).
Need to figure out why this is happening with the location component anyway, maybe the real problem resides in dash-core-components/src/components/Loading.react.js ...) 🤔
@alexcjohnson@T4rk1n sorry for the personal tag, but thought it might be useful to make sure that this issue has some more visibility and is on the roadmap.
I assume its been buried in the backlog in the last two years, but seems like its still an issue for many users.
Thankfully there's streamlit instead now to develop in. How can it be three years, a javascript fix posted, and direct dev tags, but not even a comment from any of the core team?
Hey @Samreay, @luggie, or @Stayermax, do you have a minimal reproducible example of a Dash app that exhibits the Location callback firing twice?
Looking back through the history of the issue, I can't actually find any code that can be used to reproduce the issue, which makes triage/diagnosis of the problem difficult. There are likely other possible causes of duplicate callbacks firing based on custom code/env setup, which would need to be eliminated from possibility.
I had a a go at creating a minimal reproducible example from the original post (which itself was not reproducible), but don't see the behaviour. Do you in your setup? or does the example need to be changed?
Hey @Samreay, @luggie, or @Stayermax, do you have a minimal reproducible example of a Dash app that exhibits the Location callback firing twice?
Looking back through the history of the issue, I can't actually find any code that can be used to reproduce the issue, which makes triage/diagnosis of the problem difficult. There are likely other possible causes of duplicate callbacks firing based on custom code/env setup, which would need to be eliminated from possibility.
I had a a go at creating a minimal reproducible example from the original post (which itself was not reproducible), but don't see the behaviour. Do you in your setup? or does the example need to be changed?
Sorry, I also don’t have the code.
From: serensoner ***@***.***>
Date: Sunday, 23 October 2022 at 15:37
To: plotly/dash ***@***.***>
Cc: Pankratov Vitaly ***@***.***>, Mention ***@***.***>
Subject: Re: [plotly/dash] [BUG] dcc.Location callback fires twice IDENTICALLY (#1049)
Hey @Samreay<https://github.com/Samreay>, @luggie<https://github.com/luggie>, or @Stayermax<https://github.com/Stayermax>, do you have a minimal reproducible example of a Dash app that exhibits the Location callback firing twice?
Looking back through the history of the issue, I can't actually find any code that can be used to reproduce the issue, which makes triage/diagnosis of the problem difficult. There are likely other possible causes of duplicate callbacks firing based on custom code/env setup, which would need to be eliminated from possibility.
I had a a go at creating a minimal reproducible example from the original post (which itself was not reproducible), but don't see the behaviour. Do you in your setup? or does the example need to be changed?
from dash import Dash, html, dcc, Input, State, Output
app = Dash(__name__)
app.layout = html.Div([html.Div(id="page-content"), dcc.Location(id="url")])
@app.callback(
Output("page-content", "children"),
Input("url", "href"),
State("url", "pathname"),
State("url", "search"),
)
def display_page(href, pathname, search):
print("HREF:", href)
print("PATHAME:", pathname)
print("SEARCH:", search)
if pathname == "/":
return html.Div(f"HOME - Search: {search}")
return html.Div(f"{pathname} - Search: {search}")
if __name__ == "__main__":
app.run_server(debug=True)
It's been a while since I worked on dash, but I created a minimal repro, but unfortunately only in the older versions:
requirements.txt dash==1.9.0 dash-renderer==1.7.0 Flask==2.0.0 Jinja2==3.0.3 markupsafe==2.1.1 werkzeug==2.0.0 itsdangerous==0.24
`main.py
`import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash
app = dash.Dash()
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Div(id='content'),
])
@app.callback(Output('content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
print(f'you are now at: {pathname}')
return pathname
app.run_server(host='0.0.0.0', debug=True)
`
—
Reply to this email directly, view it on GitHub<#1049 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJFOCUG3AZ4CUNEQAXUNXBDWEUWQ7ANCNFSM4J3PPKIQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Thanks heaps @serensoner! I can confirm that your example has duplicate callback invocations, when run with Dash 1.9. However not on the most recent Dash, where there's only one callback invocation. Bisecting suggests that this bug was actually fixed in Dash 1.16.... which was released September 4 2020, interestingly, about the time you were speculating @alexcjohnson that this bug could have been fixed: plotly/dash-core-components#858 (comment)
@alexcjohnson, given we can't identify a reproducible example showing this bug in the latest Dash, maybe this issue should be closed? If someone is able to come up with an example showing it's still there, might be better to start with a fresh issue.
@ned2 thanks for digging into this. Good to know at least some of these cases have been fixed! @luggie any chance you can post an app showing the problem you're still seeing? We really need a reproduction case in order to get to the bottom of this. After plotly/dash-core-components#858 (comment) I seem to have felt we had more to do:
The boundaries of the problem have changed a little, as evidenced by this test, but it’s definitely not fixed.
but my comment may just have been based on the preceding comment by @astrowonk rather than having seen the problem myself.
@ned2 thanks for digging into this. Good to know at least some of these cases have been fixed! @luggie any chance you can post an app showing the problem you're still seeing? We really need a reproduction case in order to get to the bottom of this. After plotly/dash-core-components#858 (comment) I seem to have felt we had more to do:
The boundaries of the problem have changed a little, as evidenced by this test, but it’s definitely not fixed.
but my comment may just have been based on the preceding comment by @astrowonk rather than having seen the problem myself.
It's worth noting that whatever I was experiencing was unrelated to this issue. My old comment on the other issue/PR was inaccurate. I am not aware of this issue affecting anything I'm doing at the moment.
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson
Activity
[-][BUG] dcc.Location callback fires twice IDENTICALLY[/-][+][BUG] dcc.Location callback fires twice IDENTICALLY when reload=False[/+][-][BUG] dcc.Location callback fires twice IDENTICALLY when reload=False[/-][+][BUG] dcc.Location callback fires twice IDENTICALLY[/+]schmidt-jake commentedon Jan 2, 2020
Is anyone else experiencing this issue?
landert commentedon Jan 3, 2020
🙋♂️
abogaard commentedon Jan 5, 2020
Me as well
bfaivre commentedon Jan 16, 2020
Same
judithbach commentedon Jan 30, 2020
me too!
davidolmo commentedon Feb 4, 2020
me too. I tried to avoid the second time execution by using a data_store flag but for some reason, as the states and inputs are exactly the same, this can't be accomplished
usser123 commentedon Feb 11, 2020
I am experiencing the same issue. Callback with a 'pathname' property as input is being triggered 4 times. The result is that a chart on another page takes a few seconds to appear rather than appear instantly when I click on the button for that page. Critical issue.
plotly#1049: dcc.Location callback fires twice, do not triggerDefault…
jgoday commentedon Feb 18, 2020
I'm experiencing this issue too.
Digging a bit in the source code, it seems a dash-renderer problem with some components default state.
Here is a quick fix to avoid this problem in Location component (jgoday@5681290).
Need to figure out why this is happening with the location component anyway, maybe the real problem resides in dash-core-components/src/components/Loading.react.js ...) 🤔
danjdo commentedon Feb 21, 2020
Me too.
ndepal commentedon Mar 27, 2020
I'm having the same issue on dash 1.9.1.
BrunoGomesCoelho commentedon Mar 31, 2020
Having the same issue here unfortunately
12 remaining items
Paulito123 commentedon May 22, 2021
Having the same problem, no fix for this?
TashaStenner commentedon Nov 3, 2021
Is there any fix? Or a workaround for this available?
Stayermax commentedon May 25, 2022
I'm still having this issue with dash 2.3.1, did anybody find working solution?
Samreay commentedon May 25, 2022
@alexcjohnson @T4rk1n sorry for the personal tag, but thought it might be useful to make sure that this issue has some more visibility and is on the roadmap.
I assume its been buried in the backlog in the last two years, but seems like its still an issue for many users.
luggie commentedon Oct 17, 2022
Still present in dash 2.6.1 :(
Samreay commentedon Oct 17, 2022
Thankfully there's streamlit instead now to develop in. How can it be three years, a javascript fix posted, and direct dev tags, but not even a comment from any of the core team?
ned2 commentedon Oct 20, 2022
Hey @Samreay, @luggie, or @Stayermax, do you have a minimal reproducible example of a Dash app that exhibits the Location callback firing twice?
Looking back through the history of the issue, I can't actually find any code that can be used to reproduce the issue, which makes triage/diagnosis of the problem difficult. There are likely other possible causes of duplicate callbacks firing based on custom code/env setup, which would need to be eliminated from possibility.
I had a a go at creating a minimal reproducible example from the original post (which itself was not reproducible), but don't see the behaviour. Do you in your setup? or does the example need to be changed?
Samreay commentedon Oct 21, 2022
Apologies mate, I'm now in a different role at a different company, so don't have access to the source to try and create a minimal example.
serensoner commentedon Oct 23, 2022
It's been a while since I worked on dash, but I created a minimal repro, but unfortunately only in the older versions:
Stayermax commentedon Oct 23, 2022
ned2 commentedon Nov 3, 2022
Thanks heaps @serensoner! I can confirm that your example has duplicate callback invocations, when run with Dash 1.9. However not on the most recent Dash, where there's only one callback invocation. Bisecting suggests that this bug was actually fixed in Dash 1.16.... which was released September 4 2020, interestingly, about the time you were speculating @alexcjohnson that this bug could have been fixed: plotly/dash-core-components#858 (comment)
@alexcjohnson, given we can't identify a reproducible example showing this bug in the latest Dash, maybe this issue should be closed? If someone is able to come up with an example showing it's still there, might be better to start with a fresh issue.
alexcjohnson commentedon Nov 4, 2022
@ned2 thanks for digging into this. Good to know at least some of these cases have been fixed! @luggie any chance you can post an app showing the problem you're still seeing? We really need a reproduction case in order to get to the bottom of this. After plotly/dash-core-components#858 (comment) I seem to have felt we had more to do:
but my comment may just have been based on the preceding comment by @astrowonk rather than having seen the problem myself.
astrowonk commentedon Nov 4, 2022
It's worth noting that whatever I was experiencing was unrelated to this issue. My old comment on the other issue/PR was inaccurate. I am not aware of this issue affecting anything I'm doing at the moment.
gvwilson commentedon Jul 24, 2024
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson