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:
@@ -29,9 +29,21 @@ export class LibraryController implements ReactiveController {
|
||||
// LIFECYCLE HOOKS
|
||||
// ===================================================================
|
||||
|
||||
/** Last observed changeGeneration from the store. */
|
||||
private lastChangeGen = libraryStore.changeGeneration;
|
||||
|
||||
hostConnected(): void {
|
||||
this.lastChangeGen = libraryStore.changeGeneration;
|
||||
|
||||
this.unsubscribe = libraryStore.subscribe(() => {
|
||||
this.host.requestUpdate();
|
||||
const gen = libraryStore.changeGeneration;
|
||||
|
||||
// Skip requestUpdate when only loading flags toggled
|
||||
// (changeGeneration unchanged means no actual data changed).
|
||||
if (gen !== this.lastChangeGen) {
|
||||
this.lastChangeGen = gen;
|
||||
this.host.requestUpdate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user