Skip to content
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

[jotai/query] atomWithQuery gets stuck in react strict mode #1418

Closed
mwisnicki opened this issue Sep 15, 2022 · 4 comments · Fixed by #1435
Closed

[jotai/query] atomWithQuery gets stuck in react strict mode #1418

mwisnicki opened this issue Sep 15, 2022 · 4 comments · Fixed by #1435
Assignees

Comments

@mwisnicki
Copy link

https://codesandbox.io/s/jotai-query-stuck-in-strict-8ffrtn?file=/src/App.tsx

If <React.StrictMode> is enabled then the query is stuck showing placeholder data.

Also, in bigger application I have this problem even without placeholderData - there the query is forever stuck in loading state with no observers attached. Seems to happen when there are many derived atoms. Hopefully it's the same root cause since I haven't been able to create smaller test case without placeholderData.

@dai-shi
Copy link
Member

dai-shi commented Sep 15, 2022

Thanks for reporting. Seems like a bug. We have struggled with StrictMode and something might still be missing.
Actually, we have one test failing with StrictMode.
#1417 may or may not be related.

Can you or anyone create a test case from the codesandbox, and then possibly try to fix it (though, it requires deeper understanding of the current implementation.)

@dai-shi dai-shi added the help wanted Please someone help on this label Sep 15, 2022
@dai-shi dai-shi changed the title atomWithQuery gets stuck in react strict mode [jotai/query] atomWithQuery gets stuck in react strict mode Sep 15, 2022
@mwisnicki
Copy link
Author

I wanted to debug it in context of my project but unfortunately I was unable to make it work.
I've checked out jotai and replaced dependency with workspace however it fails to resolve type.
Unfortunately I have no experience using workspaces and no other idea how to do it.

@dai-shi
Copy link
Member

dai-shi commented Sep 21, 2022

#1435 would probably fix it, if it's done.
currently, it seems to work: https://codesandbox.io/s/jotai-query-stuck-in-strict-forked-qr2fzs

@mwisnicki
Copy link
Author

Thanks, it seems to also work with my full project. Requests are cancelled as before due to unmount but then retried on mount.

@dai-shi dai-shi removed the help wanted Please someone help on this label Sep 22, 2022
@dai-shi dai-shi self-assigned this Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants