Show a loading symbol while gathering data

It’s a minor issue because it’s working otherwise. I just wish it wouldn’t do that lol.

Oh, try telling it show_initially=False

Well so I changed the way it’s created. Here is the layout section:

        dbc.Row([
            html.Center([
                dbc.Button(
                    'Generate Graph',
                    id='data-button',
                    n_clicks=0,
                    color='secondary',
                ),
            ]),
            html.Div(
                id='loading',
                children=[])
            # dls.Scale(
            #     id='loading',
            #     children=[])

And the callback:

@app.callback(
    Output('store', 'data'),
    Output('error-alert', 'is_open'),
    Output('graph-redirect', 'pathname'),
    Input('data-button', 'n_clicks'),
    State('engine-drop', 'value'),
    State('start-date', 'value'),
    State('region-drop', 'value'),
    State('report-options', 'value'),
    State('loading', 'children'),
    prevent_initial_call=True,
    background=True,
    running=[
        (Output('data-button', 'disabled'), True, False),
        # (Output('loading', 'visibility'), True, False),
        (Output('loading', 'children'), dls.Scale(), ''),
    ],
    
)

Either way, I did try show_initially=False before changing and it didn’t matter. It’s not just the spinner though, it’s the button also. It starts off as disabled and then activates.

1 Like

Hey @bpolasek did you ever solve the issue with the “flashing” of the running Output()'s?