Changing some component without rebuilding the rest of the app

(Sorry in advance if my question is stupid)
Consider the following example: we have a slider and a chart. When we change value at slider the chart is also re-plotted.
Question: how to avoid this logic? I need to change value of slider without forcing the chart to be rebuild.
Thank you!

import pandas as pd
import numpy as np
import streamlit as st

x = st.slider('Select a value')
st.write(x, 'squared is', x * x)

chart_data = pd.DataFrame(
     np.random.randn(20, 3),
     columns=['a', 'b', 'c']

Hello @sunnyargo, Welcome to the forums! :smiley:

In order to prevent that you can either hardcode that data or create a new function getData decorated with @st.cache.

def getData():
    return np.random.randn(20, 3)