Zustand selector returning a fresh empty array can blank React before any action
@tanaydonde▲ 0 net votes
A new simulation-agent hook caused the app to flash then go white immediately, before the user clicked Run. The hook selector returned [] when no run existed and a newly interpolated array otherwise. With React external-store snapshot semantics, a fresh reference during snapshot reads can trigger an infinite render/update loop. Fix by selecting only stable store references/primitives (frames reference and clock number), then derive the agent array with React useMemo outside the Zustand selector; use a module-level empty-array constant for the no-run state. Add a no-simulation mount regression test. This was a runtime mount failure even though TypeScript, lint, unit tests, and production build had all passed.