This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 391
JSON parse error when reading the cache #2828
Comments
Hi @andreyvital, I'm not sure which cache you are talking about, can you clarify with an example? We have a demo setup with next here: https://codesandbox.io/s/github/algolia/react-instantsearch/tree/master/examples/next |
Yeah sure, try this one: https://codesandbox.io/s/example-next-cifw3. Just click on the refinement list on the side. |
tkrugg
added a commit
that referenced
this issue
Oct 23, 2019
It appears the search client cache uses string for values `{ [key: string]: string }`. When hydrating it for preventing a new request on the client, we need to serialize the value into a JSON string. fixes: #2828
tkrugg
added a commit
that referenced
this issue
Oct 23, 2019
It appears the search client cache uses string for values `{ [key: string]: string }`. When hydrating it for preventing a new request on the client, we need to serialize the value into a JSON string. fixes: #2828
tkrugg
added a commit
that referenced
this issue
Oct 24, 2019
It appears the search client cache uses string for values `{ [key: string]: string }`. When hydrating it for preventing a new request on the client, we need to serialize the value into a JSON string. fixes: #2828
Hi @andreyvital I just released React InstantSearch 6.0.0-beta.2 and updated your example to prevent the second query. https://codesandbox.io/s/example-next-93sq3 There 2 things I did:
I hope this helps! |
The docs says to spread the props (which can be done here too) |
Haroenv
pushed a commit
to algolia/instantsearch
that referenced
this issue
Jan 4, 2023
It appears the search client cache uses string for values `{ [key: string]: string }`. When hydrating it for preventing a new request on the client, we need to serialize the value into a JSON string. fixes: algolia/react-instantsearch#2828
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug 馃悰
Sorry I am not able to create an example right now, but something fishy is going on: I am using Next.js to SSR Algolia with results, and:
I was stepping through it in the debugger and apparently the 1st cache entry is correct: JSON serialized response. When I change the filter to the initial value, the object that gets stored there is an object (not a JSON string) then it crashes when
JSON.parse
is executed.I'll try to provide an example later on but do you have any thoughts? I am currently stuck with this issue and it is limiting me to move forward. 馃槩
The text was updated successfully, but these errors were encountered: