0.8.2 Nav appears to break url pathname callbacks
- dash version:
#1.8.0 - dash-bootstrap-components version:
#0.8.2 - components affected by bug: Nav
Appears as if Navlink clicks aren't triggering URL path change callback. The URL appears to update in the display bar (testing in Firefox), but the callback for URL path change doesn't get triggered (although can be triggered if forcing the page to refresh).
Downgrading to dbc 0.8.1 solved the issue.
Posting here just for awareness.
Hi @daniel-saunders
Thanks for reporting! I wasn't able to reproduce this. I tried the below code on both Chrome and Firefox with dbc 0.8.2 and didn't have any problems.
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container(
[
dcc.Location(id="url"),
dbc.Nav(
[
dbc.NavLink("Page 1", href="/page-1"),
dbc.NavLink("Page 2", href="/page-2"),
]
),
html.Div(id="output"),
]
)
@app.callback(Output("output", "children"), [Input("url", "pathname")])
def on_url_change(pathname):
return pathname
if __name__ == "__main__":
app.run_server(debug=True)
Can you test this example at your end? And if possible could you share an example that demonstrates the problem you're seeing?
Hi am having the same problem. For me this examples does not work. I do not why... also downgrading to the previous version does not fix it.
I just downgraded to the Dash version 1.8 that solved my problem. Maybe it has something todo with https://github.com/plotly/dash-core-components/pull/743
I just downgraded to the Dash version 1.8 that solved my problem. Maybe it has something todo with plotly/dash-core-components#743
Thanks @matthijsramlab, it does indeed appear this was the problem. I tested against Dash 1.8.0 since that's what the original post found the issue with, but with Dash 1.9.0 I can now reproduce the problem. Will see what's necessary to fix.
@matthijsramlab @daniel-saunders
I just made a prerelease that I think will address this issue, if you have time to try it out I'd appreciate knowing if it resolved the issue for you!
pip install dash-bootstrap-components==0.8.3rc1
I still need to check that this hasn't broken anything else (shouldn't have...) but assuming it's all good I'll try release it as a full release over the next couple days.
I also had the same issue with latest public release, now it's fixed for me.
dash-bootstrap-components==0.8.3rc1 dash==1.9.0 python==3.8.0
confirm as well - I also had the same issue with latest public release, now it's fixed for me.
dash-bootstrap-components==0.8.3rc1 dash==1.9.0 python==3.8.0
Thanks!
Thanks for all the reports. The fix is now part of the latest stable release 0.8.3 (on PyPI, conda to follow soon).
You should now be able to fix with
pip install -U dash-bootstrap-components
You can check which version you have installed with
python -c "from dash_bootstrap_components import __version__; print(__version__)"
I'm going to close this now, but if anyone has further problems feel free to reopen or open a new issue.
Hello,
apparently, the issue is back again.
Using
dash 1.18.1 dash-bootstrap-components 0.11.1 dash-core-components 1.14.1 dash-html-components 1.1.1
I am not able to run @tcbegley example from above. Although the url in the browser address bar is updated the dcc.Location callback is not triggered and hence the content not updated automatically. Only after pressing return. Using external_link is a workaround but, in that case the whole page is reloaded instead of only the target component.
However, the example form here using normal dcc.Link seem to work as expected with only reloading the updated component.
Can we reopen this or is a new issue better?
Using normal dcc.Link seems to work.
Hey @tstorek
I just ran the example above without issues using latest versions of dash and dash-bootstrap-components (same versions as you in fact)
dash 1.18.1
dash-bootstrap-components 0.11.1
dash-core-components 1.14.1
dash-html-components 1.1.1
Do you see any error messages either in the terminal or in your browser's console?
Hello, no, there is no output at all.
This is weird. Only the browser address-bar is updated. But not the content. Substituting dbc.NavLink with dcc.Link works as expected. I have no clue where is may come from. Did you type in the adresses manually or by clicking the Link?
Here's what I see when I run the app.

You just see an unchanging / below?
Which browser / OS are you using?
I just tried FIrefox and Chrome. I now tested with a fresh project with dash only environment and WOW it works :)
I am now happy but at the same time even more confused. I think I will kill the complete other environment 🗡️
Thank you, though!
Huh... that's very odd. If you get any clarity on what might have been going on in the other environment or you see the same thing happening again do let me know.
Hi, actually I want to feedback on the same issue with the latest version of dash and dash-bootstrap for the same script in a conda env. Also an unchanging '/' below.
And I just accidentally tried to install the dash-bootstrap through pip install rather than conda install, the issue gone
So I just suspect, if there is any BUG for the package in the conda env or there is any conflicts for it
Hey @songholmes
Can you check for me which versions of Dash and dash-bootstrap-components you had installed in your conda environment? The conda packages are sourced from PyPI by conda-forge so there should be no difference. FWIW I just installed dash-bootstrap-components in a fresh conda environment and tested the above app with no issues.
You can check the versions you have installed either by running
conda list
or doing something like
python -c "from dash import __version__; print(__version__)"
python -c "from dash_bootstrap_components import __version__; print(__version__)"
Hi Tom, my package version is as below: dash: 1.19.0 dash-bootstrap-components: 0.12.2
actually, I tried again with conda env recently and also not found this issue. Anyway, since the issue is not there, thanks for your clarification
I am getting this issue now with:
dash 1.19.0 pyhd3eb1b0_0
dash-auth 1.4.1 pyhd3deb0d_0 conda-forge
dash-bootstrap-components 0.12.2 pypi_0 pypi
dash-core-components 1.15.0 pypi_0 pypi
dash-html-components 1.1.2 pypi_0 pypi
dash-renderer 1.9.0 pypi_0 pypi
dash-table 4.11.2 pypi_0 pypi
if I change dbc.NavLink to dcc.Link it works perfectly, and I have another app where dash bootstrap components is 0.12.0 and dbc.NavLink works perfectly - I suspect if I downgrade bootstrap components in the current app it will work (That is my next step) but something is wrong here
Hi @iwatts3519, thanks for reporting
I am not seeing an issue running the example app above (pasted below again for convenience) with the below versions of Dash libraries installed which appear to match those that you have installed.
Could you both test the simple app and see if it works at your end, and if so, possibly share a version of your app that demonstrates the issue?
Could you also let me know what OS and browser you are using?
dash 1.19.0
dash-bootstrap-components 0.12.2
dash-core-components 1.15.0
dash-html-components 1.1.2
dash-renderer 1.9.0
dash-table 4.11.2
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container(
[
dcc.Location(id="url"),
dbc.Nav(
[
dbc.NavLink("Page 1", href="/page-1"),
dbc.NavLink("Page 2", href="/page-2"),
]
),
html.Div(id="output"),
]
)
@app.callback(Output("output", "children"), [Input("url", "pathname")])
def on_url_change(pathname):
return pathname
if __name__ == "__main__":
app.run_server(debug=True)
Hi I am happy now to have it running on 0.12.0. When I have some time, possibly tomorrow, I will recreate a copy of the environment, upgrade to 0.12.2 and try my app and your app in the upgraded version. I don't want to mess with it now it is working. Cheers Ian
EDIT: It is a multi page app if that might make a difference - not sure it will but thought I would mention it