Skip to content

chore(deps): upgrade to Redux Toolkit 2 and react-redux 9 - #8139

Open
talissoncosta wants to merge 1 commit into
mainfrom
chore/upgrade-rtk-2-react-redux-9
Open

chore(deps): upgrade to Redux Toolkit 2 and react-redux 9#8139
talissoncosta wants to merge 1 commit into
mainfrom
chore/upgrade-rtk-2-react-redux-9

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #8140.

@reduxjs/toolkit 1.9.1 → 2.12.0, react-redux 8.0.2 → 9.3.0, redux 4 → 5.

Why now: react-redux@8 supports React up to 18 and we run 19.2, and RTK 2 adds skipPollingIfUnfocused, which #8132's verify console needs.

No store changes were needed. Three files:

  • common/service.ts, common/useInfiniteScroll.ts: import from @reduxjs/toolkit/query and /query/react, replacing the dist and src paths RTK 2 no longer ships. UseQuery is no longer exported, so TypedUseQuery replaces it.
  • CreateSAML.tsx: fallbacks for idp_metadata_xml and allow_idp_initiated, both optional on SAMLConfiguration.

How did you test this code?

  • typecheck: 951 errors on main → 934, no new failures (baseline diffed per error, since it isn't clean)
  • test:unit: 284 pass
  • bundle: compiles
  • lint: clean on the changed files

Manual checks on the preview, covering the store paths types can't:

  • Log out and in, reload a logged-in session (redux-persist rehydration)
  • A paginated list, e.g. segments or identities, loads further pages (useInfiniteScroll)
  • SAML config create and edit
  • Environment webhook create and edit, and tag creation

react-redux 8 only declares support up to React 18, and we run React 19, so the
pairing was already unsupported. RTK 2 also brings skipPollingIfUnfocused, which
the onboarding verify console needs to stop polling an abandoned tab.

The store needed no changes: configureStore already used the middleware callback
form, no slice uses extraReducers, and nothing calls connect().

- service.ts and useInfiniteScroll.ts imported types from @reduxjs/toolkit/dist
  and /src, which RTK 2 no longer ships. Both now use the public /query and
  /query/react entries. Importing from /src had pulled RTK's own uncompiled
  source into our programme, producing errors inside node_modules.
- UseQuery is no longer exported; TypedUseQuery is the public equivalent.
- CreateSAML falls back for two optional response fields. RTK 2 makes mutation
  results narrowable, which removed 10 pre-existing errors in that file and
  exposed these 4 shallower ones.

Typecheck goes from 951 errors to 934 with no new failures. Unit tests (284) and
the production bundle both pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@talissoncosta
talissoncosta requested a review from a team as a code owner July 28, 2026 16:17
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team July 28, 2026 16:17
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jul 28, 2026 4:18pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jul 28, 2026 4:18pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jul 28, 2026 4:18pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Updates frontend Redux Toolkit and React Redux dependency versions, replaces internal RTK Query imports with public exports, and changes useInfiniteScroll to use TypedUseQuery. SAML create and update handlers now provide fallback values for nullable metadata XML and IdP-initiated configuration fields.

Estimated code review effort: 2 (Simple) | ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-8139 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-8139 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8139 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8139 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8139 Finished ✅ Results

@github-actions github-actions Bot added the chore label Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ac3e1184-3a5f-49ee-a31d-f023dbd0e806

📥 Commits

Reviewing files that changed from the base of the PR and between e6e8a9b and 34168c7.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • frontend/common/service.ts
  • frontend/common/useInfiniteScroll.ts
  • frontend/package.json
  • frontend/web/components/pages/organisation-settings/tabs/sso/saml/modals/CreateSAML.tsx

Comment on lines 5 to 6
import { PagedRequest } from './types/requests'
import { PagedResponse } from './types/responses'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use the configured frontend import aliases.

Replace the local relative imports with common/ paths to comply with the repository guideline.

Proposed fix
-import { PagedRequest } from './types/requests'
-import { PagedResponse } from './types/responses'
+import { PagedRequest } from 'common/types/requests'
+import { PagedResponse } from 'common/types/responses'

-import useDebounce from './useDebounce'
+import useDebounce from 'common/useDebounce'

Also applies to: 8-8

Source: Coding guidelines

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18796 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute
commit  34168c7
info  🔄 Run: #18796 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #18796 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  4 passed

Details

stats  4 tests across 3 suites
duration  35.3 seconds
commit  34168c7
info  🔄 Run: #18796 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18796 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  48.5 seconds
commit  34168c7
info  🔄 Run: #18796 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18796 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40 seconds
commit  34168c7
info  🔄 Run: #18796 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18793 (attempt 2)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.1 seconds
commit  34168c7
info  🔄 Run: #18793 (attempt 2)

✅ private-cloud · depot-ubuntu-latest-16 — run #18793 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  35.8 seconds
commit  34168c7
info  🔄 Run: #18793 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18793 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37 seconds
commit  34168c7
info  🔄 Run: #18793 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18793 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.9 seconds
commit  34168c7
info  🔄 Run: #18793 (attempt 1)

❌ oss · depot-ubuntu-latest-arm-16 — run #18793 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

failed  1 failed

Details

stats  1 test across 1 suite
duration  21.9 seconds
commit  34168c7
info  📦 Artifacts: View test results and HTML report
🔄 Run: #18793 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@talissoncosta
talissoncosta marked this pull request as draft July 28, 2026 16:51
@talissoncosta
talissoncosta marked this pull request as ready for review July 28, 2026 17:11
@github-actions github-actions Bot added chore and removed chore labels Jul 28, 2026
@talissoncosta
talissoncosta requested a review from Zaimwa9 July 28, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Redux Toolkit 2 and react-redux 9

1 participant