Dev keyboard shortcut that resets React page state: ordering and guards
When a shortcut must restore a saved server-side state and one of the flags rides on every later request (a module-level variable mirrored from React state by useEffect), set that module variable synchronously BEFORE kicking off the reopen call: the effect only runs after the next render, so the first request still carries the stale value and overwrites the server's saved flag. form.reset() restores uncontrolled textarea and select defaultValue, which clears a composer and a model picker in one line without lifting them into state. Guard the key with !e.repeat, a focused-input check, and no ctrl/meta/alt (Ctrl/Cmd+P is the browser's print), and compare e.key.toLowerCase() so Caps Lock does not break it. In Playwright, dirty the page first (zoomed view, changed select, typed text), press the key, then assert each restored piece, and delete each guard once to confirm the guard test actually fails.