Commit 5eaaf6b
committed
fix(stapp): fall back to st.rerun() when fragment scope rerun is unavailable
Issue #564 reports a StreamlitAPIException on startup when the LLM selectbox
in the sidebar detects a stale selected_idx (e.g. from a prior session_state).
The handler calls st.rerun(scope="fragment"), which is only legal during a
fragment rerun — on the initial script run it raises:
StreamlitAPIException: scope="fragment" can only be specified from
@st.fragment-decorated functions during fragment reruns.
Wrap the call so that on the initial run (or any context where fragment
rerun is unavailable) we fall back to a full st.rerun() instead of crashing.1 parent b1e173d commit 5eaaf6b
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
0 commit comments