Loading_state property of dcc.Loading component is None

Hello, I am trying to change a component property when a Loading component is called.
The loader works perfectly fine, but a callback, whose Input is the loading_state property of the Loading component, is not being triggered.
Indeed, this property is always None, even though the Loading component is working when needed.
And I would expect that dictionary to have the form given in the docs:
https://dash.plotly.com/dash-core-components/loading

The callback is the following:

@dash_app.callback(
            Output(component_id='My_map', component_property= 'style'),
            Input(component_id='loading_number_from_map', component_property= 'loading_state'),
            )
def update_map_cursor(loading_state):
            ...

Thanks in advance!

1 Like

I can see that the ‘loading_state’ property comes from dash-renderer that is not in use any more, right?

Is there a way that I could get the information about the loading state of a HTML component and change its style?
I read the docs:

However I am not able to update the style of the dcc from the CSS.

Any help would be appreciated :slight_smile:

Hello, is there any update on this? I am running into the same problem. Is there an alternative to using loading_state in order to trigger some behaviour in another component while it is loading?

facing similar issue the loading_state is not capture

Have you tried using the running prop? You can now use that in regular callbacks as of Dash 2.16

2 Likes

BTW, you can make the “loading_state” property work, using the mentioned above “running” parameter:

@callback(
    Output('ohlc-graph', 'figure'),
    Input('ohlc-graph', 'relayoutData'),
    running=[
        Output('ohlc-graph', 'loading_state'),
        {'is_loading': True},
        {'is_loading': False},
    ],
)
def relayout_ohlc(relayout_data):

And then, if you need the “loading_state” of the “ohlc_graph” in another callback:

@callback(
    Output('trades-table-div', 'children'),
    Input('ohlc-graph', 'loading_state')
)
def get_trades_table(loading_state):