Skip to content

Conversation

@markerikson
Copy link
Collaborator

@markerikson markerikson commented Nov 2, 2025

This PR:

  • Improves perf for tag updates:
    • Copies getCurrent from core
    • Uses that in removeCacheKeyFromTags to ensure we're filtering plain arrays of tags
  • Improves perf for tag invalidation:
    • Adds a pending requests counter to the invalidationByTags middleware
    • Replaces the existing hasPendingRequests logic that iterated over all cache entries, with a simple counter comparison
  • Improves perf for some duplicate map/filter ops:
    • Adds a filterMap util that runs both a predicate and a mapper in a single loop
    • Uses that in places where we did variations of filter().filter().map()
    • Removes the tiny flatten() util we had in favor of standard .flatMap()

Partial work on #3823 , but a different angle.

Combined, I see some small but meaningful improvements for updates in a many-entries-many-tags scenario, like here:

Before:

image

After:

image

@codesandbox
Copy link

codesandbox bot commented Nov 2, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

size-limit report 📦

Path Size
1. entry point: @reduxjs/toolkit/query (modern.mjs) 3.68 KB (-0.08% 🔽)
1. entry point: @reduxjs/toolkit/query/react (modern.mjs) 15.22 KB (+0.14% 🔺)
1. entry point: @reduxjs/toolkit/query (cjs, production.min.cjs) 24.47 KB (-0.12% 🔽)
1. entry point: @reduxjs/toolkit/query/react (cjs, production.min.cjs) 26.82 KB (+0.15% 🔺)
2. entry point: @reduxjs/toolkit/query (without dependencies) (cjs, production.min.cjs) 11.18 KB (+0.39% 🔺)
3. createApi (.modern.mjs) 15.63 KB (+0.16% 🔺)
3. createApi (react) (.modern.mjs) 17.63 KB (+0.17% 🔺)

@netlify
Copy link

netlify bot commented Nov 2, 2025

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

Name Link
🔨 Latest commit bec3efc
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/6907eae78af89c00086faa0c
😎 Deploy Preview https://deploy-preview-5126--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.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 2, 2025

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

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

@netlify
Copy link

netlify bot commented Nov 2, 2025

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

Name Link
🔨 Latest commit d02a7dd
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/6907ed4c5e21840008a5b160
😎 Deploy Preview https://deploy-preview-5126--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 merged commit 9392c4c into master Nov 3, 2025
120 checks passed
@aryaemami59 aryaemami59 deleted the feature/3823-invalidation-perf branch November 3, 2025 06:20
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.

2 participants