mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Revert "Add hack to prevent rerendering legacy views in development"
This reverts commit 4d9ad8381f
.
This commit is contained in:
parent
b6dcda1473
commit
d330f93bae
1 changed files with 2 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { Action } from 'history';
|
import { Action } from 'history';
|
||||||
import { FunctionComponent, useEffect, useRef } from 'react';
|
import { FunctionComponent, useEffect } from 'react';
|
||||||
import { useLocation, useNavigationType } from 'react-router-dom';
|
import { useLocation, useNavigationType } from 'react-router-dom';
|
||||||
|
|
||||||
import globalize from 'lib/globalize';
|
import globalize from 'lib/globalize';
|
||||||
|
@ -58,13 +58,6 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
||||||
isThemeMediaSupported = false,
|
isThemeMediaSupported = false,
|
||||||
transition
|
transition
|
||||||
}) => {
|
}) => {
|
||||||
/**
|
|
||||||
* HACK: This is a hack to workaround intentional behavior in React strict mode when running in development.
|
|
||||||
* Legacy views will break if loaded twice so we need to avoid that. This will likely stop working in React 19.
|
|
||||||
* refs: https://stackoverflow.com/a/72238236
|
|
||||||
*/
|
|
||||||
const isLoaded = useRef(false);
|
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigationType = useNavigationType();
|
const navigationType = useNavigationType();
|
||||||
|
|
||||||
|
@ -98,11 +91,7 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isLoaded.current) loadPage();
|
loadPage();
|
||||||
|
|
||||||
return () => {
|
|
||||||
isLoaded.current = true;
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
// location.state and navigationType are NOT included as dependencies here since dialogs will update state while the current view stays the same
|
// location.state and navigationType are NOT included as dependencies here since dialogs will update state while the current view stays the same
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue