Plotly resize bug with dcc intervals

I am working on a streaming application with dash that changes and I am using dcc intervals to update the app every 2 seconds. So I want to perform a loading when the time interval for the dcc interval is less than 5 seconds. So the dcc interval with the id "loading-counter" stops at 5 seconds and then the other dcc interval that updates graph continues, this works, the only problem is that when the page shows the graph and some of the items resizes and shrinks. How can I resolve this problem. I have tried everything possible, like changing the page architecture and all but nothing works

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div(


                      dcc.Interval(id="app-update", interval =2000),
                      dcc.Interval(id="loading-counter", max_intervals =5, interval =1000),




    Output("loading-test", 'className'),
    Output('main-div', 'style'),
    Input('loading-counter', 'n_intervals'),
    Input('loading-counter', 'max_intervals '),
def update_output_div(n, max_n):
    if n is None) or input_value<max_n:
        return "sk-plane", {"display": "none"}
        return None, None