1
0
Fork 0

Further make use of Navigation API

history.length is seriously not reliable
This commit is contained in:
Lim Chee Aun 2023-11-01 21:56:37 +08:00
parent 616b9fcf02
commit 3361ffc366

View file

@ -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,
);