Haven // Internal Architecture
fromRaw() method, inserts, and stamps a cachedAt timestamp for freshness tracking.partial: true so consumers can distinguish "loading" from "not found." Used for optimistic references before full data arrives.undefined, not stale data — this surfaces missing-reference bugs early rather than silently serving old state.useStoreWithEqualityFn. Callers describe what they want; the nexus owns subscription granularity. The store is never touched directly from component code.NexusPersistence adapter — the same nexus runs on Electron (filesystem), web (localStorage), and React Native without any domain logic changing.CommunityMessageNexus, created on first access and destroyed when the community is removed. The registry lives inside HavenCore as a nested class — it manages the per-community map, handles cache cleanup on removal, and injects the shared viewerMessagePolicyStore into each instance at construction time. Per-community message state stays fully isolated while the cross-cutting policy concern is shared efficiently.
projectVisibleChannelMessages) are pure: canonical messages + policy in → visible messages out. No side effects. No domain knowledge leakage.
suppressAuthorFilter set. They see all messages regardless of block state — you cannot block a moderator out of their own moderation visibility.snapshot reference holds the last computed array. The selector reads a revision counter to subscribe, then compares the new projection against the snapshot using a stable equality function. If equal, it returns the same object reference — React bails out of the re-render entirely without touching the DOM.