docs(use-search-params): add warning about optional default values for schema …#397
docs(use-search-params): add warning about optional default values for schema …#397kyrregjerstad wants to merge 1 commit intosvecosystem:mainfrom
Conversation
|
|
Hi @kyrregjerstad, thanks for the PR! This PR was opened from the Please create a new branch in your fork (e.g. Closing this PR to keep things tidy. |
Summary
Adds documentation warning that schema fields using
.optional()without explicit defaults will be silently ignored and cannot update the URL.Why
useSearchParamsextracts field information by validating an empty object against the schema. Fields without defaults won't appear in the validation result, so the hook doesn't recognize them as valid parameters for URL updates.This caused me some headache when
params.fieldName = valuesilently failed to update the URL.