-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
test(query-core): add test case for queryClient.isFetching #8720
base: main
Are you sure you want to change the base?
test(query-core): add test case for queryClient.isFetching #8720
Conversation
View your CI Pipeline Execution ↗ for commit 0bf7deb.
☁️ Nx Cloud last updated this comment at |
queryFn: () => sleep(300).then(() => 'data'), | ||
}) | ||
expect(queryClient.isFetching()).toBe(1) | ||
queryClient.prefetchQuery({ | ||
queryKey: key2, | ||
queryFn: () => sleep(200).then(() => 'data'), |
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.
since we use real timers per default, please keep those times short (5ms and 10ms at most), or use fake timers and advance them how you want.
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.
now that I think about it, we’re actually having problems with these kinds of tests, as they tend to be pretty flaky (see useIsFetching). The reason is probably batching, and how much power the machine has / how much work it has to do, so it appears often in CI that updates are batched together.
using fake timers is better (we have an example for that in the code-base somewhere, too)
I agree, thanks for feedback!👍 |
No description provided.