Skip to content

Abort pending requests if the cache entry is removed#5061

Merged
markerikson merged 3 commits into
masterfrom
feature/4942-abort-retries
Aug 30, 2025
Merged

Abort pending requests if the cache entry is removed#5061
markerikson merged 3 commits into
masterfrom
feature/4942-abort-retries

Conversation

@markerikson

@markerikson markerikson commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

This PR:

  • Updates the RTKQ internals to rearrange the API instance setup in module.ts so that buildInitiate() is called before buildMiddleware(), and then makes getRunningQueryThunk available to buildMiddleware
  • Updates cacheCollection.ts to:
  • We already expose the abort signal into the retryCondition callback, via extraArgs.baseQueryApi.signal. Added a test to verify it gets marked as aborted if we have aborted the in-flight request.

Fixes #4942

@codesandbox

codesandbox Bot commented Aug 26, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci

codesandbox-ci Bot commented Aug 26, 2025

Copy link
Copy Markdown

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 dbb5e65:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@github-actions

github-actions Bot commented Aug 26, 2025

Copy link
Copy Markdown

size-limit report 📦

Path Size
1. entry point: @reduxjs/toolkit/query/react (modern.mjs) 15.1 KB (+0.32% 🔺)
1. entry point: @reduxjs/toolkit/query (cjs, production.min.cjs) 24.18 KB (+0.37% 🔺)
1. entry point: @reduxjs/toolkit/query/react (cjs, production.min.cjs) 26.42 KB (-0.22% 🔽)
2. entry point: @reduxjs/toolkit/query (without dependencies) (cjs, production.min.cjs) 10.82 KB (+0.47% 🔺)
3. createApi (.modern.mjs) 15.5 KB (+0.21% 🔺)
3. createApi (react) (.modern.mjs) 17.5 KB (+0.26% 🔺)

@netlify

netlify Bot commented Aug 26, 2025

Copy link
Copy Markdown

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit dbb5e65
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/68ae161f1182d10008f181d2
😎 Deploy Preview https://deploy-preview-5061--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@markerikson markerikson force-pushed the feature/4942-abort-retries branch from 8aee196 to fc597ba Compare August 26, 2025 20:14
@markerikson markerikson force-pushed the feature/4942-abort-retries branch from fc597ba to dbb5e65 Compare August 26, 2025 20:16
@markerikson markerikson merged commit 407688d into master Aug 30, 2025
114 checks passed
@aryaemami59 aryaemami59 deleted the feature/4942-abort-retries branch September 16, 2025 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query retries occur after component with useQuery hook is unmounted

2 participants