nuqs icon indicating copy to clipboard operation
nuqs copied to clipboard

Add support for parsing arrays into base64 strings in the URL.

Open harrisrobin opened this issue 1 year ago • 1 comments

Hi, first off all, thank you for writing this lib @franky47 , it's been a real life saviour!

While running into a use case where I need to keep state in the URL, I noticed that having objects in the URL break in certain messaging apps like whatsapp, telegram and kakaotalk (that's all i've tested).

As a result, I opt-ed to store my arrays as a base64 string in the URL, which works quite well for my use-case. I don't know if this is something other people seek, but wanted to make a PR incase it's of any interest.

I tried to keep it very close to parseAsArrayOf:

  const [selectedTags, setSelectedTags] = useQueryState(
    "selectedTags",
    parseAsBase64ArrayOf(parseAsJson<TagOption>()).withDefault([]),
  )

harrisrobin avatar May 01 '24 13:05 harrisrobin

@harrisrobin is attempting to deploy a commit to the 47ng Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 01 '24 13:05 vercel[bot]