mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix UI freeze when opening same path
This commit is contained in:
parent
3a33ed9ffc
commit
fb2d4487f3
1 changed files with 17 additions and 0 deletions
|
@ -39,6 +39,9 @@ class AppRouter {
|
|||
constructor() {
|
||||
document.addEventListener('viewshow', () => this.onViewShow());
|
||||
|
||||
this.lastPath = history.location.pathname + history.location.search;
|
||||
this.listen();
|
||||
|
||||
// TODO: Can this baseRoute logic be simplified?
|
||||
this.baseRoute = window.location.href.split('?')[0].replace(this.#getRequestFile(), '');
|
||||
// support hashbang
|
||||
|
@ -100,6 +103,20 @@ class AppRouter {
|
|||
return this.promiseShow;
|
||||
}
|
||||
|
||||
listen() {
|
||||
history.listen(({ location }) => {
|
||||
const normalizedPath = location.pathname.replace(/^!/, '');
|
||||
const fullPath = normalizedPath + location.search;
|
||||
|
||||
if (fullPath === this.lastPath) {
|
||||
console.debug('[appRouter] path did not change, resolving promise');
|
||||
this.onViewShow();
|
||||
}
|
||||
|
||||
this.lastPath = fullPath;
|
||||
});
|
||||
}
|
||||
|
||||
baseUrl() {
|
||||
return this.baseRoute;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue