Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

RecoilURLSync has unnecessary encodeURIComponent for search serializer #2291

Open
alexeychikk opened this issue Oct 19, 2023 · 0 comments
Open

Comments

@alexeychikk
Copy link

alexeychikk commented Oct 19, 2023

I don't understand why do you need encodeURIComponent since you already delegate serialization to the user

url.search = encodeURIComponent(serialize(unwrapState(items)));

My use-case is the following:

import { parse, stringify } from 'query-string';
// ...
          <RecoilURLSync
            serialize={stringify}
            deserialize={parse}
            location={{ part: 'search' }}
          >

This redundant encodeURIComponent encodes = and & characters in the already serialized string.
For example gameId=foo&gameId=bar becomes gameId%3Dfoo%26gameId%3Dbar

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant