{"version":3,"file":"HydrationBoundary.cjs","sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { useDbClient } from './DbProvider'\nimport type { DehydratedDbState } from '@tanstack/db'\nimport type { ReactNode } from 'react'\n\nexport type HydrationBoundaryProps = {\n  state: DehydratedDbState\n  children?: ReactNode\n}\n\nexport function HydrationBoundary({ state, children }: HydrationBoundaryProps) {\n  const client = useDbClient()\n  const hydrated = useRef<\n    { client: typeof client; state: DehydratedDbState } | undefined\n  >(undefined)\n\n  if (hydrated.current?.client !== client || hydrated.current.state !== state) {\n    client.hydrate(state)\n    hydrated.current = { client, state }\n  }\n\n  return children\n}\n"],"names":[],"mappings":";;;;;AAYO;AACL;AACA;AAIA;AACE;AACA;AAA6B;AAG/B;AACF;;"}