-
-
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
fix(query-core): add error management around this.setData(data) #7642
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
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 3277657:
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 8b4edd3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
const queryFn = vi.fn<Array<unknown>, unknown>() | ||
|
||
queryFn.mockImplementation(async () => { | ||
await sleep(50) |
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.
let's get those numbers down:
await sleep(50) | |
await sleep(10) |
queryClient.prefetchQuery({ queryKey: key, queryFn }) | ||
const query = queryCache.find({ queryKey: key })! | ||
await sleep(100) |
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.
queryClient.prefetchQuery({ queryKey: key, queryFn }) | |
const query = queryCache.find({ queryKey: key })! | |
await sleep(100) | |
await queryClient.prefetchQuery({ queryKey: key, queryFn }) | |
const query = queryCache.find({ queryKey: key })! |
const query = queryCache.find({ queryKey: key })! | ||
await sleep(100) | ||
expect(queryFn).toHaveBeenCalledTimes(1) | ||
await query.fetch() |
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 don't understand why we fetch twice: first with the prefetching, and then with query.fetch
. Shouldn't await prefetchQuery(...)
be enough to get the query into error state ?
some types are not quite right with your mocks, which is why the pipeline fails |
This aim to fix #6954. I am not sure that the test perfectly reproduces the initial issue as I am really new to this code base but it was failing before the try catch and seems to pass after the fix.