fix: keep the schedule's stack selected on prefill and edit (#1496)

Opening the New Schedule modal from a stack's Schedule action, or editing
a stack-targeted task, set the node and the stack, but the node-change
effect then ran and cleared the stack, forcing the user to reselect it.

Move the stack-clear out of that effect into the Node picker's change
handler so it only fires on a user-driven node change. A programmatic node
set from prefill or edit now preserves the stack.
This commit is contained in:
Anso
2026-06-28 03:18:27 -04:00
committed by GitHub
parent 3bece54e72
commit a6d431f0d7
2 changed files with 37 additions and 3 deletions
@@ -201,12 +201,13 @@ export default function ScheduledOperationsView({ filterNodeId, onClearFilter, p
return () => { cancelled = true; };
}, [formAction, formTargetId, formNodeId]);
// Re-fetch stacks when node changes
// Re-fetch stacks when the node changes. Clearing a stale stack selection is
// done in the Node picker's onValueChange (a user-driven change), not here, so
// a prefilled or edited node keeps its stack instead of being wiped on open.
useEffect(() => {
if (!dialogOpen) return;
if (formNodeId) {
fetchStacks(formNodeId);
setFormTargetId('');
} else {
setStacks([]);
}
@@ -790,7 +791,7 @@ export default function ScheduledOperationsView({ filterNodeId, onClearFilter, p
<Combobox
options={nodeOptions}
value={formNodeId}
onValueChange={setFormNodeId}
onValueChange={(val) => { setFormNodeId(val); setFormTargetId(''); }}
placeholder="Select node..."
/>
</div>