diff --git a/src/renderer/src/components/settings/PrivacyDiagnosticsSection.tsx b/src/renderer/src/components/settings/PrivacyDiagnosticsSection.tsx index 107f2ec3a..67ecbb7b2 100644 --- a/src/renderer/src/components/settings/PrivacyDiagnosticsSection.tsx +++ b/src/renderer/src/components/settings/PrivacyDiagnosticsSection.tsx @@ -52,10 +52,6 @@ export function PrivacyDiagnosticsSection(): React.JSX.Element { } }, []) - useEffect(() => { - activeBundleSubmissionIdRef.current = bundle?.bundleSubmissionId ?? null - }, [bundle]) - const handleOpenFolder = useCallback(async (): Promise => { try { await window.api.diagnostics.openTraceFolder() @@ -91,6 +87,9 @@ export function PrivacyDiagnosticsSection(): React.JSX.Element { await window.api.diagnostics.discardBundlePreview(nextBundle.bundleSubmissionId) return } + // Why: unmount cleanup may run before a passive ref mirror would fire; + // keep the retained preview id in sync at the creation/clear sites. + activeBundleSubmissionIdRef.current = nextBundle.bundleSubmissionId setBundle(nextBundle) setPreviewOpened(false) setTicketId(null)