A callback that handles Location
looks as follow:
layout
dash_app.layout = html.Div([
dcc.Location(id='location', refresh=True),
dbc.Nav(
[
dbc.NavItem(
dbc.NavLink(html.I(className="bi bi-box-arrow-right text-dark"),
id='logout-link',
href='/auth/logout'
),
)
],
pills=True,
),
page_container
])
callback
@dash_app.callback(Output('location', 'pathname'),
Input('logout-link', 'n_clicks'),
State('logout-link', 'href'),
prevent_initial_call=True)
def handle_logout(n_clicks, href):
return href
When i click the component logout-link
the location in an address bar gets actually changed, BUT page doesnāt get reloaded and this is wierd as before iāve tried the same approach in different callbacks and it worked well when i simply return a new pathname