From eaed8feb4235f6930fceb247c364e20f638eb71a Mon Sep 17 00:00:00 2001 From: EthanHealy01 Date: Thu, 23 Apr 2026 18:59:36 +0100 Subject: [PATCH] aikido change requests --- frontend/src/core/components/viewer/LocalEmbedPDF.tsx | 6 +++--- frontend/src/core/hooks/useFileWithUrl.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/core/components/viewer/LocalEmbedPDF.tsx b/frontend/src/core/components/viewer/LocalEmbedPDF.tsx index 26bca6288d..11f9decee8 100644 --- a/frontend/src/core/components/viewer/LocalEmbedPDF.tsx +++ b/frontend/src/core/components/viewer/LocalEmbedPDF.tsx @@ -174,9 +174,9 @@ export function LocalEmbedPDF({ } else if (url) { setPdfUrl(url); } - // `url` omitted intentionally — file presence takes priority; URL changes trigger - // remount via fileStableKey anyway. - }, [fileStableKey]); + // When file is present, use the stable key to avoid blob URL churn from FileContext + // re-renders. When only url is provided, depend on url directly so changes are picked up. + }, [file ? fileStableKey : url]); // Keyed by fileStableKey to avoid recomputing on every FileContext re-render. const exportFileName = useMemo(() => { diff --git a/frontend/src/core/hooks/useFileWithUrl.ts b/frontend/src/core/hooks/useFileWithUrl.ts index fc6dd62026..be654357b5 100644 --- a/frontend/src/core/hooks/useFileWithUrl.ts +++ b/frontend/src/core/hooks/useFileWithUrl.ts @@ -36,7 +36,7 @@ export function useFileWithUrl( } // When stableKey is provided, only recreate when the file identity changes — not // when getFiles() returns a new object reference for the same underlying file. - }, [stableKey !== undefined ? stableKey : file]); + }, [stableKey != null ? stableKey : file]); useEffect(() => { const url = result?.url;