Fix query loading state after skipped cache removal#5301
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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 9e59630:
|
|
Pushed 776af49 to make the published-artifact browser examples install Chromium explicitly before running Playwright. The four failing jobs ( Local checks:
The new GitHub Actions runs are currently waiting for fork-run approval before they can execute. |
|
Pushed 829995d with a follow-up CI tweak. The previous browser-install step reached Playwright, but Checked locally:
|
|
Pushed 0db95f4 after checking the current-head logs. The The workflow now clears Checked locally:
|
|
Pushed 2ee7cb1 with another published-artifact CI follow-up. The current-head logs showed This now uses Checked locally:
|
1c3b987 to
6f03da2
Compare
|
Pushed 6f03da2 with one more Playwright install follow-up. The current-head logs showed the example-local path from The install step now uses Checked locally:
|
|
Pushed fc60c22 with another published-artifact CI follow-up. The current-head logs showed that This update skips Playwright browser download during the initial example dependency install, then removes the resolved Chromium browser directory immediately before the explicit Checked locally:
|
|
Pushed 829938c after the approved run produced fresh logs. The updated This moves Checked locally:
|
|
Pushed 7a68114 to fix the workflow parser issue from the previous commit. The
|
|
Pushed c3aff79 after inspecting the current-head logs from the approved run. The failed Playwright rows now show Checked locally:
|
|
Pushed 80bd04e after the current-head logs showed the 30-second wait still expired. The failure is now clearly before Checked locally:
|
|
The current head is green now. On
The rest of the visible check set is success, skipped, or neutral, and the PR merge state is clean. |
|
I've opened #5310 to fix the CI failures caused by the Playwright browser tests. |
80bd04e to
9e59630
Compare
Summary
Fixes #5300.
When a hook is skipped, it keeps the last successful result so the skipped state can still expose previous
data. If that cache entry is removed while skipped, unskipping should treat the next request as a fresh load instead of reusing the stale skipped result.This resets the hook's last result when the current query state is uninitialized because the cache entry disappeared while skipped, while preserving the existing behavior for normal arg changes that intentionally keep previous data during a new fetch.
Tests
yarn workspace @reduxjs/toolkit vitest --run src/query/tests/buildHooks.test.tsx -t 'unskipping a removed query cache entry restarts as an initial load'yarn workspace @reduxjs/toolkit vitest --run src/query/tests/buildHooks.test.tsxyarn workspace @reduxjs/toolkit vitest --run src/query/tests/buildThunks.test.tsx src/query/tests/cacheCollection.test.tsyarn workspace @reduxjs/toolkit testDISABLE_V8_COMPILE_CACHE=1 yarn workspace @reduxjs/toolkit eslint src/query/react/buildHooks.ts src/query/tests/buildHooks.test.tsxyarn prettier --check packages/toolkit/src/query/react/buildHooks.ts packages/toolkit/src/query/tests/buildHooks.test.tsxyarn workspace @reduxjs/toolkit buildgit diff --check