Close rewind menu when the action errors

handleSelect only ran setIsOpen(false) on the success path. When the
rewind action failed, the catch block swallowed the error but the menu
stayed open, blocking subsequent interactions with the page.

Close in finally so success and error both dismiss the menu.
This commit is contained in:
Mohamed Boudra
2026-05-26 15:37:17 +07:00
parent 81407c5ffc
commit 58e7fd0e3e
@@ -61,11 +61,11 @@ export const RewindMenu = memo(function RewindMenu({
setPendingMode(mode); setPendingMode(mode);
try { try {
await onRewind({ mode, rewoundText }); await onRewind({ mode, rewoundText });
setIsOpen(false);
} catch { } catch {
// useRewindAgentMutation owns the toast; the menu only owns flow state. // useRewindAgentMutation owns the toast; the menu only owns flow state.
} finally { } finally {
setPendingMode(null); setPendingMode(null);
setIsOpen(false);
} }
}, },
[isLocked, onRewind, rewoundText], [isLocked, onRewind, rewoundText],