-
Notifications
You must be signed in to change notification settings - Fork 18
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
Infinite execution when using jotai-apollo atoms #69
Comments
Thanks for the reproduction @lazakrisz and the cases where it fails and where it doesn't. That's really helpful! This sounds like a classic integration testing problem. I don't know what may be causing this. The biggest help you could do is to add some test cases to ScopeProvider.test.tsx. If you can make it fail, then open a draft PR with the failing tests, and I can help figure out how to make them pass. The |
thank you @loganvolkers , will start to investigate this! 🔍 |
Update as I was investigating this:
by default each async atom in jotai uses Suspense in order to suspend until the data is available. (source: https://jotai.org/docs/utilities/async) bunshi/src/react/ScopeProvider.test.tsx Line 570 in 7594a71
However if the Suspense boundary is wrapping the entire application (in my Apps case) or in case of this test (see here: bunshi/src/react/ScopeProvider.test.tsx Line 635 in 7594a71
bunshi/src/react/ScopeProvider.test.tsx Line 684 in 7594a71
Furthermore I have also forked and updated the Stackblitz to showcase this same behaviour: https://stackblitz.com/edit/vitejs-vite-eqmpey?file=src%2FApp.tsx I have added the new code within the LoadableList .
I also want to mention that there are currently two solutions to this problem from an application perspective:
I believe both are valid solutions, let me know what you think @loganvolkers 👍 |
hello 👋 ,
first of amazing library thank you so much. as I was using the lib I noticed that whenever I create an atom (from jotai-apollo) within a molecule it keeps infinitely running (maybe related to dependencies?)
Couple other things that I have tried:
atomsWithQuery
), I also tried to memoize the client getter (second param ofatomsWithQuery
) but none of these worked.If I memoized the molecule constructor function then I got an error saying that the dependencies have changes which is not supported.
here is a stackblitz with the issue: https://stackblitz.com/edit/vitejs-vite-xaz7lw?file=src%2FApp.tsx
if you uncomment the following part:
you should see continuous console logs from the molecule:

if there is any way I can help please let me know (ex.: pr, tests etc...), although I'll probably require some assistance 🙏 .
The text was updated successfully, but these errors were encountered: