mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-18 14:33:19 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user