High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(web): prevent event manager from throwing error (#26156)
Michel Heusschenf207f99e868a
diff --git a/web/src/lib/utils/base-event-manager.svelte.ts b/web/src/lib/utils/base-event-manager.svelte.tsindex 1b5135dfd9..5112076988 100644--- a/web/src/lib/utils/base-event-manager.svelte.ts+++ b/web/src/lib/utils/base-event-manager.svelte.ts@@ -15,7 +15,7 @@ const nextId = () => count++;const noop = () => {};export class BaseEventManager<Events extends EventsBase> {- #callbacks: EventItem<Events>[] = $state([]);+ #callbacks: EventItem<Events>[] = $state.raw([]);on(subscriptions: EventMap<Events>): () => void {const cleanups = Object.entries(subscriptions).map(([event, callback]) =>@@ -36,7 +36,7 @@ export class BaseEventManager<Events extends EventsBase> {// eslint-disable-next-line @typescript-eslint/no-explicit-anyconst item = { id: nextId(), event, callback } as EventItem<Events, any>;- this.#callbacks.push(item);+ this.#callbacks = [...this.#callbacks, item];return () => {this.#callbacks = this.#callbacks.filter((current) => current.id !== item.id);