@@ -152,7 +152,6 @@ export function PreviewView({ |
152 | 152 | Boolean(onSendAnnotation); |
153 | 153 | const activeRecordingTabIds = useActiveBrowserRecordingTabIds(); |
154 | 154 | const pickActiveRef = useRef<{ cancelled: boolean } | null>(null); |
155 | | - const isMountedRef = useRef(true); |
156 | 155 | const previewState = useThreadPreviewState(threadRef); |
157 | 156 | const recentHistoryEntries = useThreadRecentHistory( |
158 | 157 | threadRef, |
@@ -173,13 +172,6 @@ export function PreviewView({ |
173 | 172 |
|
174 | 173 | usePreviewSession(threadRef); |
175 | 174 |
|
176 | | - useEffect(() => { |
177 | | - isMountedRef.current = true; |
178 | | - return () => { |
179 | | - isMountedRef.current = false; |
180 | | - }; |
181 | | - }, []); |
182 | | - |
183 | 175 | const tabId = requestedTabId ?? previewState.activeTabId; |
184 | 176 | const runtimeTabId = tabId |
185 | 177 | ? previewRuntimeTabId(threadRef, previewState.serverEpoch, tabId) |
@@ -726,7 +718,7 @@ export function PreviewView({ |
726 | 718 | const isCurrentPick = pickActiveRef.current === pickRequest; |
727 | 719 | if (isCurrentPick) { |
728 | 720 | pickActiveRef.current = null; |
729 | | - if (isMountedRef.current) setPickActive(false); |
| 721 | + setPickActive(false); |
730 | 722 | } |
731 | 723 | if ( |
732 | 724 | (isCurrentPick || submitted) && |
@@ -752,7 +744,7 @@ export function PreviewView({ |
752 | 744 | // The accepted pick must survive further clicks, tab changes, and unmount; stop cancellation here. |
753 | 745 | if (pickActiveRef.current === pickRequest) { |
754 | 746 | pickActiveRef.current = null; |
755 | | - if (isMountedRef.current) setPickActive(false); |
| 747 | + setPickActive(false); |
756 | 748 | submitted = true; |
757 | 749 | } |
758 | 750 | const { annotation: picked, submission, screenshotFailed = false } = result; |
@@ -811,7 +803,7 @@ export function PreviewView({ |
811 | 803 | if (previewBridge && runtimeTabId) { |
812 | 804 | void previewBridge.cancelPickElement(runtimeTabId).catch(() => undefined); |
813 | 805 | } |
814 | | - if (isMountedRef.current) setPickActive(false); |
| 806 | + setPickActive(false); |
815 | 807 | }; |
816 | 808 | }, [runtimeTabId]); |
817 | 809 |
|
|