Multiple page Dash app cannot go back to index page

Hi all,

I’m in the process of learning Dash app and trying to develop multipage Dash app front-end. By following the guide from this page: https://dash.plot.ly/urls, I was able to create multipage Dash app and call each page whenever the specific url/pathname found.

However, if I want to go back to the index page the Dash app always stuck with “Updating…” title in the browser tab and the index page never loaded (only left the navbar and a blank page after it).

So am I missing something here?

The structure if my files is more or less like this:

app.py
page_layout.py
|----------- body_index
|----------- body_page1
|----------- body_page2

the app.py contains the “dynamic_page_content” object that will be loaded in the app.layout together with the navbar object:

dynamic_body_content = html.Div([
dcc.Location(id=‘url’, refresh=False),
html.Div(id=‘page-content’)
])

app.layout = html.Div([pl.navbar, dynamic_body_content])

the app.py contains the only one “@app.callback” which return the corresponding page according to the url/pathname with conditional like this:

@app.callback(dash.dependencies.Output(‘page-content’, ‘children’),
[dash.dependencies.Input(‘url’, ‘pathname’)])
def display_page(pathname):
if pathname == ‘/page1’:
return pl.body_page1
elif pathname == ‘/page2’:
return pl.body_page2
else:
return pl.body_index

It’s solved,

After looking again at the code, the problem is on the dynamic body layout code. I made some changes by replacing “dcc.Link” with “html.A” component on the layout and the behavior of the links are back to normal / as expected.

Regards,
febrifahmi