zustand-querystring
zustand-querystring copied to clipboard
Query string formatting is odd?
My app has a very simple usage of this library where it stores the "search" query from a search box.
The store is set up like this:
const useShopStore = create<State>(
querystring(
(set) => ({
query: "",
items: undefined,
fetchItems: async search => {
set(() => ({ items: undefined, query: search?.query }))
const inventory = await storeService.getItems(search);
set(() => ({ items: inventory.items }))
},
}),
{
select(_: string) {
return {
query: true
}
}
}))
It works, but the formatting of the query string in the address bar looks very odd. The resulting url is: http://localhost:3000/shop?$=query=some%20search%20query;;
I believe the proper formatting would be: http://localhost:3000/shop?query=some%20search%20query
Is this an error in the library or something that is configurable? Thanks in advance.