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

Idea for overhaul #42

Closed
dai-shi opened this issue Sep 8, 2023 · 1 comment · Fixed by #45
Closed

Idea for overhaul #42

dai-shi opened this issue Sep 8, 2023 · 1 comment · Fixed by #45

Comments

@dai-shi
Copy link
Member

dai-shi commented Sep 8, 2023

I've kept saying in several places that we may need to re-design this library from scratch.


A bit of context: https://blog.axlight.com/posts/you-might-not-need-react-query-for-jotai/

I had been struggling with the mismatch, and ended up with creating a new library jotai-tanstack-query.

I thought, const [dataAtom, statusAtom] = atomsWithQuery(...) was a nice hack, but it's not nice in DX. The library impl is also complicated.


The mismatch is still there. We have several issues reported. In fact, jotai-urql is overhauled due to the same reason.

So, the general idea is to re-design the binding api fully from the TanStack Query perspective.
I can help from the Jotai perspective, but we need someone with TanStack Query background to maintain this project.

@cyrilchapon
Copy link

cyrilchapon commented Nov 30, 2023

To add some feedback on DX for a newcoming :

  • indeed the 2-atoms-returned logic seems strange, and not really aligned with any jotai usual logic (AFAIK)
  • even more misleading : the fact both atoms are actually writeable atoms, which basically blew my mind (what are the setters actually supposed to do ?)
  • The typing is broken, and you inevitably encounter this one and have to take 15 minutes to find this issue to get a workaround
  • I personally hard tried to go with Suspense and ErrorBoundary (a hacky react-native port of it) without any actual success. Rolled back to the statusAtom
  • statusAtom typing is not correctly discriminated (might be a react-query trouble though); such as isSuccess and isError are not discriminating data which is inferred as undefinedable anyway

@dai-shi dai-shi linked a pull request Dec 7, 2023 that will close this issue
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