import type { WritableAtom } from "jotai"; import { useHydrateAtoms } from "jotai/utils"; import type { ReactNode } from "react"; type AnyWritableAtom = WritableAtom; /** * Component that hydrates Jotai atoms with initial values before rendering children. * Use this in tests to pre-populate async atoms, bypassing Suspense. */ export function HydrateAtoms({ initialValues, children, }: { initialValues: Iterable; children: ReactNode; }) { useHydrateAtoms([...initialValues]); return <>{children}; }