-
Notifications
You must be signed in to change notification settings - Fork 14
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
atomsWithQuery wrap by atom(async) will trigger unnecessary loading #50
Comments
Interesting. It seems like a bug, but I don't have any idea how it happens. |
i try to debug it. in example one whe use cache,it will not use promise https://github.com/jotaijs/jotai-tanstack-query/blob/main/src/common.ts#L331 ,will triiger like sync atom. |
I would like to make sure if it's a jotai-tanstack-query issue. If it can be reproduced with bare Jotai, it's more unexpected. |
i try anthor example, async wrap with a new query
tanstack query solve this case is use https://tanstack.com/query/v5/docs/react/reference/useSuspenseQueries https://codesandbox.io/p/sandbox/elated-dust-57sk3m?file=%2Fsrc%2FApp.tsx%3A42%2C25 |
Does |
code example: https://codesandbox.io/p/sandbox/small-brook-7vmvwd?file=%2Fsrc%2FApp.tsx%3A32%2C27
first use fetch data directly
const data = useAtomValue(userAtom);
the console will not has loading
two wrap by atom(async)
const data = useAtomValue(asyncToJsonAtom);
the console will has loading
in example two, even if use query cache data, the loading will show again
so screen will flash: content->loaindg->content. because time is short
expect:
not trigger loading
The text was updated successfully, but these errors were encountered: