Skip to content

[BUG] dcc.Location not honoring refresh=False for dynamic layouts starting with dash v 1.13 #1346

Closed
@giftculture

Description

@giftculture

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context
Please provide us your environment so we can easily reproduce the issue.

dash                         1.13.0
dash-auth                    1.3.2
dash-bootstrap-components    0.10.1a0
dash-core-components         1.10.0
dash-daq                     0.1.7
dash-html-components         1.0.3
dash-renderer                1.5.0
dash-table                   4.8.0
dash-table-experiments       0.6.0
dash.ly                      0.17.3

Describe the bug
Starting with dash v 1.13, dcc.Location isn't respecting refresh=False for dynamic layouts, it is getting triggered over and over again

index.py

@app.callback(Output(‘page-content’, ‘children’),
[Input(‘url’, ‘pathname’)])
def display_page(pathname):
     if pathname == ‘/apps/cumulative_pnl’:
          return cumulative_pnl.return_layout()

cumulative_pnl.py looks like:

from dash.dependencies import Input, Output, State
import dash_html_components as html
import dash_core_components as dcc
import datetime

from . import render_graphs

from app import app



def return_layout():
    return html.Div(
        [
            datetime.datetime.now(),
            dcc.Location(id='url', refresh=False),
        ],
    )

In Dash 1.13, it seems to get stuck in an infinite loop, triggering over and over, with the datetime continually updating. If I comment out dcc.Location, I get the expected behavior, so there's something going on with dcc.Location - it appears to not be respecting refresh=False
Expected behavior

Layout renders one time, with the current datetime (works under dash 1.12)
Each time I go to /apps/cumulative_pnl, the return_layout function is invoked and my layout renders once, showing the datetime as of page load

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions