-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary client-side query with SSR #6258
Comments
I have confirmed that this is not related to Remix, Next.js versions also have the same behaviour. |
Check for Edge Runtime: Ensure you're not deploying to Edge Runtime; use Node.js runtime instead. |
Hi @sefai, it should be fixed with this : #6275 About the 3rd point though, ideally the loader should not run (except if you do need to react to parameters change on the server), as it's better to hit Algolia endpoints directly from the browser when rendering client-side. I don't know if there's a way to either tell Remix not to call them, or if it does get called then if it's not an initial request you could skip the call of You can open another issue if you're still running into trouble with this. |
Thank you @aymeric-giraudet , How can I test the master branch, is there an npm package for that. For the second part, for each HierarchicalMenu refinement I have a SEO path, so I need that path from the server with other path related data not present on algolia indexes. By the way I switched to Next.js, because somehow the same Remix app's CPU usage is way higher than Next.js on cloudflare, I am not sure if it is related to InstantSearch but right now the page only has InstantSearch components. |
you can follow these instructions: https://ci.codesandbox.io/status/algolia/instantsearch/pr/6275/builds/521243 |
Hello @Haroenv, I have tried with the following packages, but the results are the same. Did you tried this fix with a HierarchicalMenu having more than one levels?
|
Hi @sefai, there is indeed a problem when selecting a nested hierarchical menu attribute, due to an explicit I will publish another fix for that but can you try to do |
Hello @aymeric-giraudet Unfortunately I switched to Next.js, I am using react-instantsearch-nextjs. |
Hello @aymeric-giraudet I still see the client-side query and a new hydration error. As you can see from the record below the root menu count changes 3 times. I am not sure if the additional fetch is caused by the hydration error. Screen.Recording.2024-07-11.at.17.17.58.movIf I set persistHierarchicalRootCount to false the counts stay the same for each hierarchical menu item, but the fetch and errors does not go away. Uploading Screen Recording 2024-07-11 at 17.26.24.mov… |
Hello @aymeric-giraudet, sorry I missed that, by patching the algoliasearch-helper package, I can confirm the additional client-side query is fixed by #6283. |
🐛 Current behavior
After the page is rendered server side, there is a duplicate client-side query. This is true for both doc and data requests.
🔍 Steps to reproduce
Live reproduction
https://shopify-hydrogen-algolia-ff7a0d8a34696233bb09.o2.myshopify.dev/
💭 Expected behavior
There should be no client-side query at Step 3.
Also, there should be no client-side query for a page refresh at Step 4.
Package version
"instantsearch.js": "^4.56.1","react-instantsearch": "^7.5.2",
Operating system
No response
Browser
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: