From d9dab6b5eec956a3a4cb07bc6026bb7460eff2b6 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 1 Nov 2023 23:14:13 +0800 Subject: [PATCH] Ok need to check if navigation is undefined --- src/pages/status.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index cd75cac6..91f9ba18 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -179,7 +179,8 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { const showMedia = parseInt(mediaParam, 10) > 0; const firstLoad = useRef( !states.prevLocation && - (history.length === 1 || navigation?.entries?.()?.length === 1), + (history.length === 1 || + ('navigation' in window && navigation?.entries?.()?.length === 1)), ); const [viewMode, setViewMode] = useState( searchParams.get('view') || firstLoad.current ? 'full' : null, @@ -879,7 +880,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { const prevLocationIsStatusPage = useMemo(() => { // Navigation API - if (navigation?.entries) { + if ('navigation' in window && navigation?.entries) { const prevEntry = navigation.entries()[navigation.currentEntry.index - 1]; if (prevEntry?.url) { return STATUS_URL_REGEX.test(prevEntry.url);