mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Ok need to check if navigation is undefined
This commit is contained in:
parent
d35d0cbe18
commit
d9dab6b5ee
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue