The best way to control Claude Code, Codex and more from any computer or phone
fix(web): a draft closed mid machine switch no longer rewrites that draft (#20442)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:15 UTC
52cd9c5a19f837f6868b5ac5c16280430feaccab
1 file changed
+9
apps/web/src/components/ChatView.tsx
+9
@@ -3276,6 +3276,15 @@ export default function ChatView(props: ChatViewProps) {
3276
useLayoutEffect(() => {
3277
environmentChangeScopeRef.current = environmentChangeScope;
3278
});
3279
+ // Leaving the scope, or unmounting, abandons a change still in flight.
3280
+ useLayoutEffect(
3281
+ () => () => {
3282
+ if (environmentChangeRef.current?.scope === environmentChangeScope) {
3283
+ environmentChangeRef.current = null;
3284
+ }
3285
+ },
3286
+ [environmentChangeScope],
3287
+ );
3288
const readPendingEnvironmentChange = () => {
3289
const pending = environmentChangeRef.current;
3290
return pending !== null && pending.scope === environmentChangeScopeRef.current ? pending : null;