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:
parent
42c0516a44
commit
c5072f77f5
2 changed files with 11 additions and 4 deletions
|
@ -4,7 +4,7 @@ import { useLocation } from 'react-router-dom';
|
|||
import globalize from '../../scripts/globalize';
|
||||
import viewManager from './viewManager';
|
||||
|
||||
interface ViewManagerPageProps {
|
||||
export interface ViewManagerPageProps {
|
||||
controller: string
|
||||
view: string
|
||||
type?: string
|
||||
|
@ -35,7 +35,7 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
|||
let viewHtml = await import(/* webpackChunkName: "[request]" */ `../../controllers/${view}`);
|
||||
viewHtml = globalize.translateHtml(viewHtml);
|
||||
|
||||
viewManager.loadView({
|
||||
const viewOptions = {
|
||||
url: location.pathname + location.search,
|
||||
controllerFactory,
|
||||
view: viewHtml,
|
||||
|
@ -48,6 +48,13 @@ const ViewManagerPage: FunctionComponent<ViewManagerPageProps> = ({
|
|||
supportsThemeMedia: isThemeMediaSupported,
|
||||
enableMediaControl: isNowPlayingBarEnabled
|
||||
}
|
||||
};
|
||||
|
||||
viewManager.tryRestoreView(viewOptions)
|
||||
.catch((result?: any) => {
|
||||
if (!result || !result.cancelled) {
|
||||
viewManager.loadView(viewOptions);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ class ViewManager {
|
|||
}
|
||||
|
||||
return viewContainer.tryRestoreView(options).then(function (view) {
|
||||
onViewChanging();
|
||||
if (onViewChanging) onViewChanging();
|
||||
onViewChange(view, options, true);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue