Files
zeekay 6c65e3e941 @hanzo/app 0.2.0: the app SDK, renamed from @hanzo/rooms
Every import, the catalog pin and the docs name @hanzo/app and
github.com/hanzoai/app. lib/rooms.ts is lib/app.ts and
components/rooms.tsx is components/app.tsx.
2026-10-22 19:07:20 -07:00

19 lines
729 B
TypeScript

'use client'
import { useMemo, useSyncExternalStore } from 'react'
/** Nothing to subscribe to: a page's own query changes only by a navigation, which renders it again. */
const NEVER = () => () => {}
/**
* The page's query as the browser has it: empty in the prerendered markup and
* on the first client paint, so hydration matches, and the real one on the
* render hydration already performs (the shape of @hanzo/app `useHydrated`).
* It asks for no Suspense boundary, which `useSearchParams` does in a static
* export.
*/
export function useQuery(): URLSearchParams {
const search = useSyncExternalStore(NEVER, () => window.location.search, () => '')
return useMemo(() => new URLSearchParams(search), [search])
}