@stainless-code/persist
Version:
Hydration-aware persistence for any reactive store — zero-dep persistSource core; codecs, backends, cross-tab transport, source + framework hydration adapters ship as opt-in recipes
20 lines (19 loc) • 790 B
text/typescript
import { t as HydrationSignal } from "../hydration-DclSpq51.mjs";
import { Accessor } from "solid-js";
//#region src/adapters/frameworks/solid.d.ts
/**
* Mount a `HydrationSignal` into Solid's reactivity via `from`. Returns an
* `Accessor<boolean>` — read it in a reactive scope (`createEffect`/component/JSX).
* Null/undefined signal → always `true`; the subscription is owned by the
* reactive scope and cleaned up on scope dispose. Renders `true` on the server.
*
* @example
* ```ts
* import { createEffect } from "solid-js";
* const hydrated = useHydrated(prefsHydration);
* createEffect(() => { if (hydrated()) renderPrefs(); });
* ```
*/
declare function useHydrated(signal: HydrationSignal | null | undefined): Accessor<boolean>;
//#endregion
export { useHydrated };