From 3361ffc366bf4c691c25777fe0e01ca4364c9548 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 1 Nov 2023 21:56:37 +0800 Subject: [PATCH] Further make use of Navigation API history.length is seriously not reliable --- src/pages/status.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 66a8aaf2..cd75cac6 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -177,7 +177,10 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { const mediaParam = searchParams.get('media'); const mediaStatusID = searchParams.get('mediaStatusID'); const showMedia = parseInt(mediaParam, 10) > 0; - const firstLoad = useRef(!states.prevLocation && history.length === 1); + const firstLoad = useRef( + !states.prevLocation && + (history.length === 1 || navigation?.entries?.()?.length === 1), + ); const [viewMode, setViewMode] = useState( searchParams.get('view') || firstLoad.current ? 'full' : null, );