combineRateLimits |
When several updates coincide in the same tick, the strongest limit wins: the longest delay, and debounce dominates throttle (it waits for settling). The store uses this to merge batched updates; adapter authors can reuse it. |
combineResolvedOptions |
Combine resolved options from multiple updates batched in the same tick. The “loudest” update wins: push over replace, full navigation over shallow, scroll over no-scroll, and the strongest rate limit. The clearOn* flags stay on only if both have them on, and b’s startTransition wins when both set one. |
createLoader |
Server-side parser. Accepts a URL string, query string, URL, URLSearchParams, Request, a record, or a promise of any of those, and returns the parsed values. In strict mode, present-but-invalid values throw. |
createMultiParser |
Build a custom multi-value parser for repeated keys (?id=1&id=2): parse receives every value of the key (params.getAll) and serialize returns one string per repeated key. Return null from parse to reject. eq defaults to ===. Only called when the key is present; an absent key resolves to the default (or null). |
createParser |
Build a custom single-value parser from a parse/serialize pair. parse returns null for a value it rejects (the key then resolves to the default). serialize defaults to String(value) and eq (used by clearOnDefault) to ===; pass eq for object values like Date. Chain .withDefault() / .withOptions() like any built-in parser. |
createSerializer |
Build a query string or URL from a parser map. Preserves unrelated params on the base, removes keys set to null, and honors clearOnDefault/urlKeys. |
createStandardSchemaV1 |
Build a Standard Schema from a parser map for use in a route’s validateSearch. The same parser definitions a component uses with useQueryStates can validate/type the route — without the component importing the route object. |
debounce |
Debounce: wait until timeMs of quiet has elapsed before committing. Use it as the limitUrlUpdates option, e.g. for a search box that should only write the URL once the user stops typing. |
hasInvalidKey |
Whether a key is PRESENT in the URL but its raw value fails to parse — stale or tampered junk that clearOnInvalid strips. An absent key is NOT invalid (it just resolves to the default), so this returns false for it. |
keepSubDelims |
Serialize search params but leave the RFC-3986 sub-delims ( ) , : ! ' raw instead of percent-encoding them. They round-trip through URLSearchParams unchanged (none is &/=/+), so this is purely cosmetic — it keeps Rison-encoded (and other structured) tokens human-readable in the address bar ((type:and,…) instead of %28type%3Aand%2C…). Pass as a query-state adapter’s serializeSearch. &, = and + stay encoded. |
parseAsArrayOf |
Array packed into a single key, comma-separated by default (?ids=1,2,3). Each item goes through itemParser; items that fail to parse are dropped ("1,x,3" → [1, 3], "x" → []), and an empty value is []. It never returns null, so clearOnInvalid never strips the key (same as nuqs). A separator inside an item is percent-encoded so it round-trips. |
parseAsCodec |
Store a structured value as an opaque token in the URL via a codec. Decode failures fall back to null (the parser contract), so a tampered/stale token resolves to the default instead of throwing. |
parseAsJson |
JSON-encoded value. A runtime validator is required (Standard Schema or a function that returns the value or throws); malformed JSON or a failed validation yields null. Validation must be sync. Equality compares JSON.stringify output. |
parseAsNativeArrayOf |
Native URL arrays via repeated keys: ?tag=a&tag=b. A multi-value parser that already has .withDefault([]) applied. Items that fail itemParser are dropped; when none parse, the key is invalid (null, so it reads as the default and clearOnInvalid strips it), except a single empty value (?tag=), which is an explicit []. Same rules as nuqs. |
parseAsNumberLiteral |
One of a fixed list of numbers, typed as their union. Anything else parses to null. Read with Number.parseFloat, like nuqs, so trailing junk is ignored ("25px" → 25 when 25 is in the list). |
parseAsStandardSchema |
Validate the raw query string through a Standard Schema (Zod, Valibot, ArkType, …) and return its output; invalid input → null. Best for scalar params (z.string().email(), z.coerce.number(), z.enum([...])); for structured values prefer parseAsJson(schema). Validation must be sync. |
parseAsStringEnum |
A value of a string enum (or any Record<string, string>), matched by the enum’s values, not its keys. Anything else parses to null. |
parseAsStringLiteral |
One of a fixed list of strings, typed as their union. Anything else parses to null. |
resolveOptions |
Resolve options across precedence layers (highest first): call-level > parser .withOptions() > hook options > adapter defaults > library defaults. Each option is picked separately from the first layer that sets it. This is what the hooks run on every setter call; adapter authors can reuse it. |
throttle |
Throttle: commit the first update quickly, then at most once per timeMs. Pass Infinity to keep state in sync while never committing to the URL. Use it as the limitUrlUpdates option. |
validateWithStandardSchema |
Run a Standard Schema synchronously, returning its output or throwing. Async validators are unsupported (matches nuqs parseAsJson). |
withTransport |
Wrap a parser with a string transport layer — the encoder/decoder stage. encode runs after the parser’s serialize, decode before its parse. Useful for base64url / signing on top of any existing parser. The inner parser’s eq, default and .withOptions() carry over, so wrapping a .withDefault() parser keeps it non-nullable. A decode that throws yields null. |