mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 16:05:43 +00:00
fix(ResourceEditor): don't reset state when selected reverts to undefined (#9295)
The bootstrap effect tracked `selected` via its early-return check, so any time `selected` flipped back to `undefined` it would re-run and reinitialize `states[effectiveWorkspace]` to empty — wiping user input. This happens in the React SDK consumer: reactify re-syncs all Svelte props on every React render, and since `selected` isn't passed through, `$props()` reverts it. Move the `selected !== undefined` check inside the existing `untrack` so the effect only tracks `effectiveWorkspace`. Bootstrap still runs once on mount; subsequent `selected` flips no longer retrigger it. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
tristantr
co-authored by
Claude Opus 4.7
parent
a31893873f
commit
60ada2fad4
@@ -207,9 +207,9 @@
|
||||
|
||||
// Bootstrap: ensure selected is set on mount (edit or new)
|
||||
$effect(() => {
|
||||
if (selected !== undefined) return
|
||||
if (!effectiveWorkspace) return
|
||||
untrack(() => {
|
||||
if (selected !== undefined) return
|
||||
selected = effectiveWorkspace
|
||||
if (!initialPath) {
|
||||
// New resource
|
||||
|
||||
Reference in New Issue
Block a user