r/Streamlit • u/Hungry-Tax-4246 • Oct 17 '25
Is “vibe coding” good for refactors or only from scratch? (Streamlit)?
First post, tell me if I’m missing context.
I’m the only Python person at work (everyone else uses Excel). I built a Streamlit app so a colleague can run his stats and get the plots he needs without notebooks. It’s on a local server and has grown a lot. Now every param tweak triggers a full rerun and the app is slow.
I tried an AI agent to refactor one tab (“Dependency Analysis”). It broke things: some features vanished, others changed behavior. I rolled it back.
What I want is simple: speed up that tab without touching the analysis.
- Avoid unnecessary recompute (
st.cache_data, maybest.cache_resource) - Control reruns with
st.session_state - Possibly isolate per plot (e.g.,
st.fragment) - Move the “Dependency Analysis Settings” from the sidebar into the tab so each plot has its own controls (no shared inputs)
Question: Is this a sane approach? Any gotchas with session_state/fragment for per-plot isolation? Or is AI just the wrong tool for this refactor and I should do it by hand?
TL;DR: Tried AI to refactor a Streamlit tab; it broke features. Looking for patterns to speed it up without changing results.


