feat(01-01): create Zustand store with 6 slices, IPC batcher, and unit tests

- Install zustand 5.x and immer 11.x dependencies
- Create 6 Zustand slices: navigation, company, selection, ui, communication, social
- Create combined store with devtools + immer middleware
- Create IPC event batcher with 50ms debounce window (schedule/flush/dispose)
- Create typed selector hooks for narrow state subscriptions
- Add 14 unit tests covering store initialization, slice behaviors, and batcher timing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 4.6 committed 2026-03-22 01:30:37 -04:00
1 parent a4de64b876
commit 5e9d36c058
13 files changed
+818 -4

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
type BatchCallback = () => void;
export function createEventBatcher(callback: BatchCallback, windowMs = 50) {
let timer: ReturnType<typeof setTimeout> | null = null;
function schedule() {
if (timer !== null) return; // already scheduled -- coalesce
timer = setTimeout(() => {
timer = null;
callback();
}, windowMs);
}
function flush() {
if (timer !== null) {
clearTimeout(timer);
timer = null;
callback();
}
}
function dispose() {
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
}
return { schedule, flush, dispose };
}