mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix dialog history
This commit is contained in:
parent
b8b0f8ea39
commit
626993a740
3 changed files with 13 additions and 2 deletions
|
@ -25,6 +25,7 @@ class AppRouter {
|
||||||
msgTimeout;
|
msgTimeout;
|
||||||
popstateOccurred = false;
|
popstateOccurred = false;
|
||||||
resolveOnNextShow;
|
resolveOnNextShow;
|
||||||
|
previousRoute = {};
|
||||||
/**
|
/**
|
||||||
* Pages of "no return" (when "Go back" should behave differently, probably quitting the application).
|
* Pages of "no return" (when "Go back" should behave differently, probably quitting the application).
|
||||||
*/
|
*/
|
||||||
|
@ -633,8 +634,13 @@ class AppRouter {
|
||||||
getHandler(route) {
|
getHandler(route) {
|
||||||
return (ctx, next) => {
|
return (ctx, next) => {
|
||||||
ctx.isBack = this.popstateOccurred;
|
ctx.isBack = this.popstateOccurred;
|
||||||
this.handleRoute(ctx, next, route);
|
|
||||||
this.popstateOccurred = false;
|
this.popstateOccurred = false;
|
||||||
|
|
||||||
|
const ignore = route.dummyRoute === true || this.previousRoute.dummyRoute === true;
|
||||||
|
this.previousRoute = route;
|
||||||
|
if (ignore) return;
|
||||||
|
|
||||||
|
this.handleRoute(ctx, next, route);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ import '../../assets/css/scrollstyles.scss';
|
||||||
animateDialogOpen(dlg);
|
animateDialogOpen(dlg);
|
||||||
|
|
||||||
if (isHistoryEnabled(dlg)) {
|
if (isHistoryEnabled(dlg)) {
|
||||||
appRouter.pushState({ dialogId: hash }, 'Dialog', `#${hash}`);
|
appRouter.show('/dialog', { dialogId: hash });
|
||||||
|
|
||||||
window.addEventListener('popstate', onHashChange);
|
window.addEventListener('popstate', onHashChange);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -560,6 +560,11 @@ import { appRouter } from '../components/appRouter';
|
||||||
serverRequest: true
|
serverRequest: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defineRoute({
|
||||||
|
path: '/dialog',
|
||||||
|
dummyRoute: true
|
||||||
|
});
|
||||||
|
|
||||||
defineRoute({
|
defineRoute({
|
||||||
path: '',
|
path: '',
|
||||||
isDefaultRoute: true,
|
isDefaultRoute: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue