Commit 4669594
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 c85b59e commit 4669594
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
0 commit comments