Skip to content

Commit

Permalink
fix(url): parse empty QS as empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
artalar committed Oct 9, 2023
1 parent e88b96c commit 3665807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/url/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const searchParamsAtom: SearchParamsAtom = Object.assign(
}, 'searchParamsAtom._set'),
lens: <T = string>(
key: string,
parse: (value?: string) => T = (value) => value as T,
parse: (value?: string) => T = (value = '') => String(value) as T,
serialize: (value: T) => string = (value) => value as string,
) => {
const theAtom = atom(
Expand All @@ -181,7 +181,7 @@ export const searchParamsAtom: SearchParamsAtom = Object.assign(
export const withSearchParamsPersist =
<T = string>(
key: string,
parse: (value?: string) => T = (value) => value as T,
parse: (value?: string) => T = (value = '') => String(value) as T,
serialize: (value: T) => string = (value) => value as string,
) =>
<A extends Atom<T>>(theAtom: A): A => {
Expand Down

1 comment on commit 3665807

@vercel
Copy link

@vercel vercel bot commented on 3665807 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.