Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Mapbox Graph wrapped in dcc.Loading lags one update behind #756

Description

Hi there,
when I wrap a Mapbox scatter plot in a dcc.Loading component, updates to this figure seem to be delayed by one update. The same logic with normal scatter plots works fine. I could reproduce this behavior with Dash Core Components 1.8.0 and previous versions.

Here's a demo:
withoutLoading
withLoading

and here's the code:

import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objects as go
from dash.dependencies import Output, Input

app = dash.Dash(__name__)

lat = [10, 10, 10, 10]
lon = [10, 20, 30, 40]

app.layout = html.Div([
    html.Div('Select a point on the map:'),
    dcc.Slider(min=0, max=3, step=1, value=0, marks=[0, 1, 2, 3], id='slider'),
    dcc.Loading(dcc.Graph(id='graphContainer'))
])

@app.callback(Output('graphContainer', 'figure'),
              [Input('slider', 'value')])
def UpdateGraph(value):
    return {'data': [go.Scattermapbox(lat=lat, lon=lon, selectedpoints=[value])],
            'layout': go.Layout(mapbox_style='carto-positron')}


app.run_server()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions