mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #6168 from viown/fix-ui-freeze
This commit is contained in:
commit
38d095b3f3
1 changed files with 17 additions and 0 deletions
|
@ -39,6 +39,9 @@ class AppRouter {
|
||||||
constructor() {
|
constructor() {
|
||||||
document.addEventListener('viewshow', () => this.onViewShow());
|
document.addEventListener('viewshow', () => this.onViewShow());
|
||||||
|
|
||||||
|
this.lastPath = history.location.pathname + history.location.search;
|
||||||
|
this.listen();
|
||||||
|
|
||||||
// TODO: Can this baseRoute logic be simplified?
|
// TODO: Can this baseRoute logic be simplified?
|
||||||
this.baseRoute = window.location.href.split('?')[0].replace(this.#getRequestFile(), '');
|
this.baseRoute = window.location.href.split('?')[0].replace(this.#getRequestFile(), '');
|
||||||
// support hashbang
|
// support hashbang
|
||||||
|
@ -100,6 +103,20 @@ class AppRouter {
|
||||||
return this.promiseShow;
|
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() {
|
baseUrl() {
|
||||||
return this.baseRoute;
|
return this.baseRoute;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue