Axis reset issue with dcc.Graph()

Issue: when I zoom in on a portion of my plot, and then double click to zoom back out the chart auto-sizes the axis ranges and I lose my previous range formatting for them.

I have seen this issue brought up before: Double click reset view button to reset zoom doesn’t restore…. However, as far as I have noticed there wasn’t ever a solution.

From what I can tell, when the dcc.Graph() element is assigned in the app layout before the callback is assigned, you lose this feature. i.e:

This method would lose predefined axis ranges when you zoom in and then out.

app.layout = html.Div([
            
        html.Div(id = 'plot', children = [
                  dcc.Graph()
                  ])
    ])

@app.callback(
    Output('plot', 'children'),
    Input('some-data-source', 'data')
    )
def generate_some_plot(data):
    fig = go.Figure()
    #add some traces and set layout
    chart = dcc.Graph(figure = fig)
    
    return chart

However, this method would preserve the original axis ranges when you zoom in and then out:

app.layout = html.Div([
            
        html.Div(id = 'plot', children = [
                   #there is no dcc.Graph() element here anymore
                  ])
    ])

@app.callback(
    Output('plot', 'children'),
    Input('some-data-source', 'data')
    )
def generate_some_plot(data):
    fig = go.Figure()
    #add some traces and set layout
    chart = dcc.Graph(figure = fig)
    
    return chart

Does anyone have any idea on how to fix this? I realize I could just do the second method, but I like having my plot elements pre-set on my page to see the structure/layout of everything before they are created.

Any help would be appreciated!

Thank you