Multiple reenders on Select with Nextjs or Remix useSearchParams #1088
Locked
juliomuhlbauer
started this conversation in
General
Replies: 1 comment 7 replies
-
I updated the issue because the examples were sharing the same zag logic. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🐛 Bug report
When updating a context on a machine with a search param from hooks from Nextjs and Remix, causes multiple reenders.
Using other solutions as Ariakit and Radix works fine with Nextjs.
I also tested Ark with Nextjs and Remix. It causes reenders too.
💥 Steps to reproduce
💻 Link to reproduction
It seems that in production works better. But in Dev is unusable. Also, Ark on production causes reenders too.
Default Zag (reenders on dev): https://zag-search-param-git-example-search-param-juliomuhlbauer.vercel.app/search-param-zag
Default Ark (reenders on prod): https://zag-search-param-git-example-search-param-juliomuhlbauer.vercel.app/search-param-ark
Repo Branch: https://github.com/juliomuhlbauer/zag/tree/example-search-param
Fix Zag (works): https://zag-search-param-git-fix-reenders-search-param-juliomuhlbauer.vercel.app/search-param-zag
Fix Ark (doesn't work yet): https://zag-search-param-git-fix-reenders-search-param-juliomuhlbauer.vercel.app/search-param-ark
Repo Branch: https://github.com/juliomuhlbauer/zag/tree/fix-reenders-search-param
🧐 Expected behavior
Only reender when changing the searchParam
🧭 Possible Solution
Passing the context directly to the state works fine:
useMachine function:
And filtering the context prop in the proxy:
🌍 System information
📝 Additional information
Other Zag issue: #1073
Ark issue: chakra-ui/ark#1817
Nextjs + Ariakit works fine:
Repo: https://github.com/juliomuhlbauer/use-search-param-ark/blob/main/src/app/search-param-ariakit/page.tsx
Demo: https://use-search-param-ark.vercel.app/search-param-ariakit?city=Jambeiro
2023-12-08.14-31-51.mp4
Beta Was this translation helpful? Give feedback.
All reactions