sailfork / t3code-github / apps/ mobile/ src/ state/ atom-registry.ts

import { AtomRegistry } from "effect/reactivity";

import {
  disposeOnFoundationReplace,
  type FoundationHotModule,
} from "../lib/foundation-fast-refresh";

declare const module: { readonly hot?: FoundationHotModule } | undefined;

export const appAtomRegistry = AtomRegistry.make();

disposeOnFoundationReplace(typeof module === "undefined" ? undefined : module.hot, () =>
  appAtomRegistry.dispose(),
);