mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(web): prevent duplicate memory page loading
This commit is contained in:
parent
6d6d7c6c77
commit
81f4f2c007
1 changed files with 8 additions and 1 deletions
|
|
@ -46,12 +46,14 @@ class MemoryManager {
|
|||
#hasNextPage: boolean;
|
||||
#page: number;
|
||||
#total: number | undefined;
|
||||
#queued: boolean;
|
||||
|
||||
constructor() {
|
||||
this.#filters = undefined;
|
||||
this.#hasNextPage = true;
|
||||
this.#page = 1;
|
||||
this.#total = $state(undefined);
|
||||
this.#queued = false;
|
||||
|
||||
eventManager.on({
|
||||
AuthLogout: () => this.clearCache(),
|
||||
|
|
@ -161,7 +163,7 @@ class MemoryManager {
|
|||
if (this.#loading === undefined) {
|
||||
this.#loading = this.load(this.#page++);
|
||||
} else {
|
||||
void this.#loading.then(() => (this.#loading = this.load(this.#page++)));
|
||||
this.#queued = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -203,6 +205,11 @@ class MemoryManager {
|
|||
}
|
||||
|
||||
this.#hasNextPage = this.memories.length < this.#total;
|
||||
|
||||
if (this.#queued) {
|
||||
this.#queued = false;
|
||||
this.load(this.#page++);
|
||||
}
|
||||
}
|
||||
|
||||
private scheduleHourlyRefresh() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue