1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix restoring views

This commit is contained in:
Bill Thornton 2022-10-24 02:17:35 -04:00
parent 42c0516a44
commit c5072f77f5
2 changed files with 11 additions and 4 deletions

View file

@ -4,7 +4,7 @@ import { useLocation } from 'react-router-dom';
import globalize from '../../scripts/globalize'; import globalize from '../../scripts/globalize';
import viewManager from './viewManager'; import viewManager from './viewManager';
interface ViewManagerPageProps { export interface ViewManagerPageProps {
controller: string controller: string
view: string view: string
type?: string type?: string
@ -35,7 +35,7 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
let viewHtml = await import(/* webpackChunkName: "[request]" */ `../../controllers/${view}`); let viewHtml = await import(/* webpackChunkName: "[request]" */ `../../controllers/${view}`);
viewHtml = globalize.translateHtml(viewHtml); viewHtml = globalize.translateHtml(viewHtml);
viewManager.loadView({ const viewOptions = {
url: location.pathname + location.search, url: location.pathname + location.search,
controllerFactory, controllerFactory,
view: viewHtml, view: viewHtml,
@ -48,7 +48,14 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
supportsThemeMedia: isThemeMediaSupported, supportsThemeMedia: isThemeMediaSupported,
enableMediaControl: isNowPlayingBarEnabled enableMediaControl: isNowPlayingBarEnabled
} }
}); };
viewManager.tryRestoreView(viewOptions)
.catch((result?: any) => {
if (!result || !result.cancelled) {
viewManager.loadView(viewOptions);
}
});
}; };
loadPage(); loadPage();

View file

@ -167,7 +167,7 @@ class ViewManager {
} }
return viewContainer.tryRestoreView(options).then(function (view) { return viewContainer.tryRestoreView(options).then(function (view) {
onViewChanging(); if (onViewChanging) onViewChanging();
onViewChange(view, options, true); onViewChange(view, options, true);
}); });
} }