Commit 2636bdb
committed
fix: use st.rerun() instead of full page reload for presets
Replace streamlit_js_eval page reload with st.rerun() for smoother UX:
- No page flash/flicker
- Scroll position preserved
- Faster (no re-fetching static assets)
Uses "delete-then-rerun" pattern: apply_preset() now deletes session_state
keys instead of setting them, forcing widgets to re-initialize fresh from
params.json. This avoids fragment caching issues.
Changes:
- ParameterManager.apply_preset(): delete keys instead of setting them
- ParameterManager.clear_parameter_session_state(): new helper method
- StreamlitUI: preset_buttons(), "Load default parameters", and "Import
parameters" now use st.rerun() with st.toast() for feedback
- Removed unused streamlit_js_eval import
- Updated tests for delete-based behavior
https://claude.ai/code/session_01BnipAqTf16J7kJVfnzah2U1 parent 3d6d768 commit 2636bdb
File tree
3 files changed
+89
-24
lines changed- src/workflow
- tests
3 files changed
+89
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | | - | |
226 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| |||
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
242 | 246 | | |
243 | 247 | | |
244 | 248 | | |
| |||
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
251 | | - | |
| 255 | + | |
252 | 256 | | |
253 | 257 | | |
254 | 258 | | |
| |||
257 | 261 | | |
258 | 262 | | |
259 | 263 | | |
260 | | - | |
| 264 | + | |
261 | 265 | | |
262 | 266 | | |
263 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
264 | 273 | | |
265 | 274 | | |
266 | 275 | | |
267 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
1092 | 1091 | | |
1093 | 1092 | | |
1094 | 1093 | | |
1095 | | - | |
1096 | | - | |
| 1094 | + | |
| 1095 | + | |
1097 | 1096 | | |
1098 | 1097 | | |
1099 | 1098 | | |
| |||
1120 | 1119 | | |
1121 | 1120 | | |
1122 | 1121 | | |
1123 | | - | |
| 1122 | + | |
1124 | 1123 | | |
1125 | 1124 | | |
1126 | 1125 | | |
1127 | | - | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1128 | 1129 | | |
1129 | 1130 | | |
1130 | 1131 | | |
| |||
1148 | 1149 | | |
1149 | 1150 | | |
1150 | 1151 | | |
1151 | | - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1152 | 1155 | | |
1153 | 1156 | | |
1154 | 1157 | | |
1155 | 1158 | | |
1156 | | - | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1157 | 1162 | | |
1158 | 1163 | | |
1159 | 1164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
199 | 205 | | |
200 | | - | |
201 | | - | |
| 206 | + | |
| 207 | + | |
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
206 | 216 | | |
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
210 | | - | |
211 | | - | |
| 220 | + | |
| 221 | + | |
212 | 222 | | |
213 | 223 | | |
214 | 224 | | |
| |||
265 | 275 | | |
266 | 276 | | |
267 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
268 | 305 | | |
269 | 306 | | |
270 | 307 | | |
| |||
0 commit comments