Not sure if I am using the session_state/st_state_patch properly

This is a follow up from this post I made:

Though the solution works, there are still issues. The video below summarizes the issue. final_60568fa3504c150036f78e1b_724039

The code is below:

       session_state = SessionState.get(default_options =False)
        # once button is pushed, load new format data
        if default_options or session_state.default_options :
               session_state.default_options = True                    

              
               # select data for default graph
               axes_options = axes_placeholder.beta_columns(3)
               #Options for default chart
               scatter_choices = scatter_choices_placeholder.beta_columns([4,4,4,4,1])

               #select x-axis
               select_box_X = axes_options[0].selectbox('Select x-axis', data_col)
               
               #select y-axis
               select_box_Y = axes_options[1].selectbox('Select y-axis', data_col)
               
               # Control colours of chart
               color = ['navy', 'blue', 'green', 'brown', 'skyblue', 'grey']

               color = axes_options[2].selectbox('Choose color', options=color)

               height = scatter_choices[0].slider('Height of chart', min_value=0.0, max_value=30.0, step=.1, value=8.0)
               # Ratio
               ratio_chart = scatter_choices[1].slider('Ratio', min_value=0, max_value=30, step=1, value=7)
               # Space
               space = scatter_choices[2].slider('Space', min_value=0.0, max_value=1.0, step=.1, value=.4)
               # Show density of plots
               alpha = scatter_choices[3].slider('Plot density', min_value=0.0, max_value=1.0,  step=.1, value=.4) 
               # Default settings button
               default_options = scatter_choices[4].button('Default')
               # Additional options
               options = scatter_choices[4].checkbox('Additional Options')
               chart = sns.jointplot(x=select_box_X, y=select_box_Y, data=Scatter_graph_data, alpha=.4, height=8.0, ratio=7, space=.4, xlim=(-0.01,1.01), ylim=(-0.01,1.01), color=color)
               chart_placeholder.pyplot(chart, use_container_width=True)

Not sure how to rectify this even with session. When I tried st.state, I get this error:

AttributeError: ‘Server’ object has no attribute ‘_session_infos’

Is there a way to halt this re-re-run of the code?

So this method, using the session, seems a lot more complicated for me anyway. I think just using the placeholder was a little easier to understand for me and will just stick to that.