Hello,
In my application (1.37.1), i have a selectbox with names. Further down there is a st.fragment function to render different aggregations of data with a st.radio option to choose the aggregation.
When the page renders for a given selectbox choice, the first render of the st.fragment function is correct, but when picking a different aggregation in the st.radio picker, the data now reflects a different product.
Is this intended behavior or a known issue? The purpose of using @st.fragment is to have the chart interaction be fast and not cause rerunning the entire page.
simplified code sample:
product = st.selectbox('Choose Product',products)
df = pullDF(product)
df2 = pullDF2(product)
@st.fragment
def renderChart():
aggregation = st.radio('Choose Aggregation',aggregations)
if aggregation =='Agg1':
fig = px.line(df)
st.plotly_chart(fig)
elif aggregation =='Agg2':
fig = px.line(df2)
st.plotly_chart(fig)
renderChart()
A workaround i think i can use is pushing df
into a st.session_state.df
and then rendering that in the @st.fragment.