-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cannot update a component while rendering a different component
Error When Using Fetcher In Multiple Places
#33
Comments
Much like the "The result of getSnapshot should be cached to avoid an infinite loop". It won't even be reported in Sentry or other error tracking software if you make a production build.
|
Simplified reproducible example: https://codesandbox.io/p/sandbox/nanostoresreact-test-3wzp6z
To test:
Cannot update a component while rendering a different component
console errorI'm having an issue where I'm trying to follow the example from here in the README regarding sending parameters down, basically exactly as the docs recommend: https://github.com/nanostores/query?tab=readme-ov-file#local-state-and-pagination
The issue I'm having is when attempting to re-use the same fetcher in another component with the same query key and arguments, I get this error.
My actual use-case is as follows
useStore(store)
runsuseStore(store)
I've done some digging and it seems to be something related to
useSyncExternalStore
. Another data fetching library had a similar issue, which was documented here:urql-graphql/urql#1382
They ended up just not using
useSyncExternalStore
, but I'm not 100% sure this issue is a problem with@nanostores/react
because I tried my best to replicate without even using@nanostores/query
and it didn't seem possible, which is why I'm logging it here.There is also a few relevant react issues filed around this error, but they don't seem to be very helpful:
facebook/react#26962
facebook/react#18178
The text was updated successfully, but these errors were encountered: