GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(web): preview element picker drops its unmount guard (#25920) · pingdotgg/t3code@067db24

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/preview
    • PreviewView.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/preview/PreviewView.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/preview/PreviewView.tsx
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export function PreviewView({
152152
Boolean(onSendAnnotation);
153153
const activeRecordingTabIds = useActiveBrowserRecordingTabIds();
154154
const pickActiveRef = useRef<{ cancelled: boolean } | null>(null);
155-
const isMountedRef = useRef(true);
156155
const previewState = useThreadPreviewState(threadRef);
157156
const recentHistoryEntries = useThreadRecentHistory(
158157
threadRef,
@@ -173,13 +172,6 @@ export function PreviewView({
173172

174173
usePreviewSession(threadRef);
175174

176-
useEffect(() => {
177-
isMountedRef.current = true;
178-
return () => {
179-
isMountedRef.current = false;
180-
};
181-
}, []);
182-
183175
const tabId = requestedTabId ?? previewState.activeTabId;
184176
const runtimeTabId = tabId
185177
? previewRuntimeTabId(threadRef, previewState.serverEpoch, tabId)
@@ -726,7 +718,7 @@ export function PreviewView({
726718
const isCurrentPick = pickActiveRef.current === pickRequest;
727719
if (isCurrentPick) {
728720
pickActiveRef.current = null;
729-
if (isMountedRef.current) setPickActive(false);
721+
setPickActive(false);
730722
}
731723
if (
732724
(isCurrentPick || submitted) &&
@@ -752,7 +744,7 @@ export function PreviewView({
752744
// The accepted pick must survive further clicks, tab changes, and unmount; stop cancellation here.
753745
if (pickActiveRef.current === pickRequest) {
754746
pickActiveRef.current = null;
755-
if (isMountedRef.current) setPickActive(false);
747+
setPickActive(false);
756748
submitted = true;
757749
}
758750
const { annotation: picked, submission, screenshotFailed = false } = result;
@@ -811,7 +803,7 @@ export function PreviewView({
811803
if (previewBridge && runtimeTabId) {
812804
void previewBridge.cancelPickElement(runtimeTabId).catch(() => undefined);
813805
}
814-
if (isMountedRef.current) setPickActive(false);
806+
setPickActive(false);
815807
};
816808
}, [runtimeTabId]);
817809

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.