Keep Zome state of plotly in Solara

How can i keep my zoom state while updating a plotly graph

import plotly.graph_objects as go
import solara as sol


@sol.component
def Plot():
    ui_state = UIState()
    analyasis_view = AnalysisView()
    print("Rendering Plot Component")
    print("Current time series length:", len(ui_state.current_time_series.value))


    fig = go.FigureWidget()
    fig.add_trace(
        go.Scatter(
            y=ui_state.current_time_series.value,
            mode="lines",
            )
        )
    
    
    for annotation in ui_state.current_annotations.value:
        fig.add_vline(
            x=annotation.position,
            line=dict(
                color=get_annot_color(annotation.tag_type),
                width=2,
                dash="dashdot",
            ),
            annotation_text=annotation.tag_type,
            annotation_position="top right"
        )
    
    fig.update_layout(
        xaxis=dict(showgrid=False),
        yaxis=dict(showgrid=False ),
        plot_bgcolor="white",
    )

    sol.FigurePlotly(
        fig,
        on_click=lambda data: analyasis_view.mark_annotation(data['points']['xs'][0]), 
    )

I’m trying to add new annotations to my plotly graph when a user clicks on the graph. However when placing a new annotation on the graph the zoom state is reset. How can i keep the zoom-state. Thanks in advance

Hey @Simon_Dierickx, welcome to the forums.

You might search for the uirevision parameter. Not sure if that helps out of my head. :grimacing: