fix: clear stale dialog actions when target pane is inactive

When a dialog action's targetSide matched but the pane was inactive,
the action was left in the store. If the pane later became active, it
would fire the stale action unexpectedly. Now inactive panes clear the
action to prevent this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
bincxz
2026-03-29 18:25:55 +08:00
parent ddb6b5af1e
commit e9ad65fef6

View File

@@ -93,7 +93,12 @@ export const useSftpDialogActionHandler = (
const action = useSftpDialogAction();
useEffect(() => {
if (!action || action.targetSide !== side || !isActive) return;
if (!action || action.targetSide !== side) return;
if (!isActive) {
// Clear stale action so it doesn't fire when this pane becomes active later
sftpDialogActionStore.clear();
return;
}
// Handle the action and clear it
switch (action.type) {