Check for reload cases too

Prevent status page from going full width when reloading itself

This checks tab's history length, so opening status page on a new tab means
length = 1.

BUT this will fail if someone copies the link and paste to another
**existing** tab with existing pre-populated history.
pull/272/head
Lim Chee Aun 2023-10-26 11:42:44 +08:00
rodzic 0038c2225b
commit 1c87dd6e41
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -168,7 +168,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
const [searchParams, setSearchParams] = useSearchParams();
const mediaParam = searchParams.get('media');
const showMedia = parseInt(mediaParam, 10) > 0;
const firstLoad = useRef(!states.prevLocation);
const firstLoad = useRef(!states.prevLocation && history.length === 1);
const [viewMode, setViewMode] = useState(
searchParams.get('view') || firstLoad.current ? 'full' : null,
);