The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): preview element picker drops its unmount guard (#25920)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 27, 2026 at 05:17 UTC
067db24e00f266ee9e2cca2b59a79062e0497401
1 file changed
+3
-11
apps/web/src/components/preview/PreviewView.tsx
+3
-11
@@ -152,7 +152,6 @@ export function PreviewView({
152
Boolean(onSendAnnotation);
153
const activeRecordingTabIds = useActiveBrowserRecordingTabIds();
154
const pickActiveRef = useRef<{ cancelled: boolean } | null>(null);
155
- const isMountedRef = useRef(true);
155
const previewState = useThreadPreviewState(threadRef);
156
const recentHistoryEntries = useThreadRecentHistory(
157
threadRef,
@@ -173,13 +172,6 @@ export function PreviewView({
172
173
usePreviewSession(threadRef);
174
176
- useEffect(() => {
177
- isMountedRef.current = true;
178
- return () => {
179
- isMountedRef.current = false;
180
- };
181
- }, []);
182
-
175
const tabId = requestedTabId ?? previewState.activeTabId;
176
const runtimeTabId = tabId
177
? previewRuntimeTabId(threadRef, previewState.serverEpoch, tabId)
@@ -726,7 +718,7 @@ export function PreviewView({
718
const isCurrentPick = pickActiveRef.current === pickRequest;
719
if (isCurrentPick) {
720
pickActiveRef.current = null;
729
- if (isMountedRef.current) setPickActive(false);
721
+ setPickActive(false);
722
}
723
if (
724
(isCurrentPick || submitted) &&
@@ -752,7 +744,7 @@ export function PreviewView({
744
// The accepted pick must survive further clicks, tab changes, and unmount; stop cancellation here.
745
if (pickActiveRef.current === pickRequest) {
746
pickActiveRef.current = null;
755
- if (isMountedRef.current) setPickActive(false);
747
+ setPickActive(false);
748
submitted = true;
749
}
750
const { annotation: picked, submission, screenshotFailed = false } = result;
@@ -811,7 +803,7 @@ export function PreviewView({
803
if (previewBridge && runtimeTabId) {
804
void previewBridge.cancelPickElement(runtimeTabId).catch(() => undefined);
805
}
814
- if (isMountedRef.current) setPickActive(false);
806
+ setPickActive(false);
807
};
808
}, [runtimeTabId]);
809