perf(14-03): add notification batching to queue store and granular change tracking to library store

- Queue store now uses queueMicrotask batching (matching library store pattern)
- Library store adds changeGeneration counter incremented only on actual data changes
- LibraryController checks changeGeneration before requestUpdate, skipping loading-only transitions
- Reduces unnecessary component re-renders during data loading cycles
This commit is contained in:
2026-03-14 13:53:59 -04:00
parent 1ec8f82ef8
commit d0c05dc1d4
3 changed files with 46 additions and 2 deletions
+9 -1
View File
@@ -52,6 +52,7 @@ class QueueStore {
};
private subscribers = new Set<Subscriber>();
private notifyScheduled = false;
constructor() {
this.initializeEventListeners();
@@ -268,7 +269,14 @@ class QueueStore {
}
private notify(): void {
this.subscribers.forEach((callback) => callback());
if (this.notifyScheduled) return;
this.notifyScheduled = true;
queueMicrotask(() => {
this.notifyScheduled = false;
for (const sub of this.subscribers) {
sub();
}
});
}
}