-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
feat(query): new implementation with peer dep #1435
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 02881ed:
|
|
Size Change: -4.42 kB (-3%) Total Size: 150 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is reasonably good, even though it introduces some behavioral changes.
src/query/atomWithQuery.ts
Outdated
} | ||
return { resultAtom, makePending, startQuery } | ||
const getOptions = (get: Getter) => ({ | ||
staleTime: 500, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to avoid failing tests with strict effect. this or retryOnMount: false
should help. otherwise, it will fetch twice in DEV mode, which is actually fine and expected.
src/query/atomWithQuery.ts
Outdated
}) | ||
|
||
const queryAtom = atom( | ||
const [dataAtom] = atomsWithTanstackQuery(getOptions, getQueryClient) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unfortunate that we can't simply return dataAtom
. We need a small wrapper to pass our current tests.
thanks! ✨ (getting back from work vacation today. i'll take a look) |
I've found another bug. The I did a reproduction comparing to tanstack/query return: https://codesandbox.io/s/winter-water-kdysdj?file=/src/App.tsx |
Good catch, @EduardoLopes ! |
Can we make this repository a monorepo later and add 'jotai-tanstack-query' to this repository? For more promotion, contribution and maintenance. It's just suggestion. BTW, thanks for your hard work! |
@nix6839 Thanks for your comment. |
RefetchOptions, | ||
RefetchQueryFilters, | ||
} from '@tanstack/query-core' | ||
import { atomsWithInfiniteQuery } from 'jotai-tanstack-query' | ||
import { atom } from 'jotai' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dai-shi! Are there plans of importing atom
from valtio/vanilla
instead? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jotai/query
will be deprecated soon.
So, you want to use jotai-tanstack-query
and, in that case, we have a PR open.
jotaijs/jotai-tanstack-query#18
There, find codesandbox-ci comment and click here
. You will then find "Local Install Instructions".
This is a big refactor on tanstack query integration. the goals are:
close #1418
close #1068
close #309
close #1454