From 9d323d7c80654bd8f973438dc346e1b5b601698c Mon Sep 17 00:00:00 2001 From: ShashiSubramanya Date: Wed, 7 Oct 2026 14:04:49 +0530 Subject: [PATCH] fix: hide SpotterCode widget inside nested version iframe Version wrapper pages load the frozen site in an iframe (?_iframe=1) and already mount their own widget, so the nested copy rendered a duplicate. Co-Authored-By: Claude Sonnet 5.5 --- src/components/FloatingAssistant/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/FloatingAssistant/index.tsx b/src/components/FloatingAssistant/index.tsx index 658f36daa..a3d6b683f 100644 --- a/src/components/FloatingAssistant/index.tsx +++ b/src/components/FloatingAssistant/index.tsx @@ -50,6 +50,14 @@ const FloatingAssistant: React.FC = () => { const [isTutorialsPage, setIsTutorialsPage] = useState( () => typeof window !== 'undefined' && isTutorialsPath(window.location.pathname), ); + // Older-version wrapper pages (e.g. /docs/26.9.0.cl) load the frozen version's site in a + // nested iframe (VersionIframe, src carries ?_iframe=1). The wrapper already mounts its own + // assistant, so the nested copy must not render a second one. Read once at load: the flag + // is on the iframe's initial URL, and in-page navigation inside it may drop the param. + const [isNestedIframe] = useState( + () => typeof window !== 'undefined' + && new URLSearchParams(window.location.search).get('_iframe') === '1', + ); // The 404 page has no fixed pathname to match against (it renders for // whatever bogus URL the user hit), so detect it via document.title // instead. NOTE: a DOM marker (id) doesn't work here — in production, @@ -495,6 +503,7 @@ const FloatingAssistant: React.FC = () => { if (pageId === CUSTOM_PAGE_ID.API_PLAYGROUND) return null; if (isTutorialsPage) return null; if (isNotFoundPage) return null; + if (isNestedIframe) return null; return ( <>