Skip to content

[wip] CONSOLE-4512, CONSOLE-5073: React 18, phase 2#16087

Open
logonoff wants to merge 13 commits intoopenshift:mainfrom
logonoff:CONSOLE-5073-shared-modules
Open

[wip] CONSOLE-4512, CONSOLE-5073: React 18, phase 2#16087
logonoff wants to merge 13 commits intoopenshift:mainfrom
logonoff:CONSOLE-5073-shared-modules

Conversation

@logonoff
Copy link
Member

@logonoff logonoff commented Mar 2, 2026

Depends on #15954, #16096, #16183

  • Update app.tsx to use createRoot
  • Version bumps:
    • react-redux 8.1.3 -> 9.2.0
    • redux 4.0.4 -> 5.0.1
    • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
    • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
    • Enhanced internal code quality and type safety across test suites.
    • Removed unused test dependencies.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 2, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 2, 2026

@logonoff: This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@logonoff
Copy link
Member Author

logonoff commented Mar 2, 2026

/label px-approved
/label docs-approved

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Mar 2, 2026
@openshift-ci openshift-ci bot requested review from Leo6Leo and TheRealJon March 2, 2026 14:50
@openshift-ci openshift-ci bot added component/core Related to console core functionality component/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/knative Related to knative-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared labels Mar 2, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 2, 2026

@logonoff: This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

This pull request updates Redux ecosystem dependencies in the frontend package: react-redux from 8.1.3 to 9.2.0, redux from ^4.0.4 to ^5.0.1, and redux-thunk from 2.4.0 to 3.1.0, while removing redux-mock-store. Import statements for redux-thunk across test files are changed from default imports to named imports. Test mock variables are refactored with stricter TypeScript typing using jest.MockedFunction instead of generic jest.Mock casts. Generic type parameters in combineReducers calls are removed to rely on type inference. Release notes are updated to document these dependency changes. No runtime behavior changes are introduced.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title references ticket numbers (CONSOLE-4512, CONSOLE-5073) but lacks clarity on primary changes; it uses '[wip]' prefix and vague phrasing that doesn't convey the core objective of upgrading redux dependencies. Clarify the title to highlight the main change: consider 'Upgrade redux, redux-thunk, and react-redux to latest versions' or 'CONSOLE-5073: Update redux ecosystem dependencies for React 18 compatibility'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx (1)

27-31: Add default useOLSConfigMock return in beforeEach to strengthen test isolation.

Tests at lines 33-36 and 38-41 don't set useOLSConfigMock, yet rely on it being in a default state. Since jest.clearAllMocks() preserves mockReturnValue implementations and only clears call history, tests become order-dependent: if a prior test sets useOLSConfigMock.mockReturnValue(true), that persists into tests expecting falsy behavior. Adding useOLSConfigMock.mockReturnValue(false) in beforeEach removes this fragility and ensures each test starts with a predictable, documented baseline.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx`
around lines 27 - 31, The tests are order-dependent because useOLSConfigMock's
mockReturnValue can leak between tests; update the beforeEach setup (the
beforeEach block that currently calls jest.clearAllMocks(),
useTranslationMock.mockReturnValue, and useDispatchMock.mockReturnValue) to also
set a clear default for useOLSConfigMock by calling
useOLSConfigMock.mockReturnValue(false) so each test starts with a predictable
falsy OLS config; keep the other mockReturnValue calls (useTranslationMock and
useDispatchMock) as-is and ensure mockDispatch remains used for useDispatchMock.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md`:
- Line 14: The release note text incorrectly references the package name
"react-thunk"; update that string to "redux-thunk" so the line reads that
plugins must use `redux-thunk` v3 to remain compatible with Console (replace
"react-thunk" with "redux-thunk" in the release note content), ensuring
consistency with package.json/shared-modules-meta.ts and all imports referencing
redux-thunk.

---

Nitpick comments:
In
`@frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx`:
- Around line 27-31: The tests are order-dependent because useOLSConfigMock's
mockReturnValue can leak between tests; update the beforeEach setup (the
beforeEach block that currently calls jest.clearAllMocks(),
useTranslationMock.mockReturnValue, and useDispatchMock.mockReturnValue) to also
set a clear default for useOLSConfigMock by calling
useOLSConfigMock.mockReturnValue(false) so each test starts with a predictable
falsy OLS config; keep the other mockReturnValue calls (useTranslationMock and
useDispatchMock) as-is and ensure mockDispatch remains used for useDispatchMock.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4a2ba98 and ce63f16.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • frontend/package.json
  • frontend/packages/console-app/src/components/detect-namespace/__tests__/namespace.spec.ts
  • frontend/packages/console-app/src/components/tour/__tests__/tour-context.spec.ts
  • frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sModels.spec.tsx
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResource.spec.tsx
  • frontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResources.spec.tsx
  • frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx
  • frontend/packages/console-shared/src/hooks/__tests__/useGetUserSettingConfigMap.spec.ts
  • frontend/packages/console-shared/src/hooks/__tests__/useUser.spec.ts
  • frontend/packages/console-shared/src/hooks/__tests__/useUserPreference.spec.ts
  • frontend/packages/console-shared/src/test-utils/unit-test-utils.tsx
  • frontend/packages/dev-console/src/utils/__tests__/usePerspectiveDetection.spec.ts
  • frontend/packages/knative-plugin/src/components/add/__tests__/EventSink.spec.tsx
  • frontend/public/components/utils/__tests__/firehose.spec.tsx
  • frontend/public/redux.ts

@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch 2 times, most recently from dfa923d to 55b9976 Compare March 9, 2026 14:13
@Leo6Leo
Copy link
Contributor

Leo6Leo commented Mar 11, 2026

/retest-required

@logonoff logonoff changed the title CONSOLE-5073: Bump redux-related shared modules to latest CONSOLE-4512, CONSOLE-5073: React 18, phase 2 Mar 11, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 11, 2026

@logonoff: This pull request references CONSOLE-4512 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Version bumps:

  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 11, 2026

@logonoff: This pull request references CONSOLE-4512 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

  • Update app.tsx to use createRoot
  • Version bumps:
  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@logonoff logonoff changed the title CONSOLE-4512, CONSOLE-5073: React 18, phase 2 [wip] CONSOLE-4512, CONSOLE-5073: React 18, phase 2 Mar 11, 2026
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2026
@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from 55b9976 to 0e2c33d Compare March 20, 2026 23:37
@openshift-ci openshift-ci bot added the kind/demo-plugin Related to dynamic-demo-plugin label Mar 20, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 20, 2026

@logonoff: This pull request references CONSOLE-4512 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Depends on #15954, #16096, #16183, #16150

  • Update app.tsx to use createRoot
  • Version bumps:
  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from 0e2c33d to 4dca5de Compare March 20, 2026 23:43
@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch 2 times, most recently from dd4bece to 287d571 Compare March 21, 2026 14:37
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 21, 2026

@logonoff: This pull request references CONSOLE-4512 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

This pull request references CONSOLE-5073 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Depends on #15954, #16096, #16183

  • Update app.tsx to use createRoot
  • Version bumps:
  • react-redux 8.1.3 -> 9.2.0
  • redux 4.0.4 -> 5.0.1
  • redux-thunk 2.4.0 -> 3.1.0

Removed redux-mock-store because the recommendation is to use a real store: https://redux.js.org/usage/writing-tests

Summary by CodeRabbit

  • Chores
  • Updated core framework dependencies to latest stable versions, including major version upgrades to state management libraries.
  • Enhanced internal code quality and type safety across test suites.
  • Removed unused test dependencies.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from 287d571 to b2b46dc Compare March 21, 2026 19:01
@openshift-ci openshift-ci bot added component/helm Related to helm-plugin component/monitoring Related to monitoring component/olm Related to OLM kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Mar 21, 2026
@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from 18d8ee0 to 8b6582a Compare March 23, 2026 16:57
@openshift-ci openshift-ci bot added the component/dashboard Related to dashboard label Mar 23, 2026
@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch 3 times, most recently from 0cf36e5 to efea63c Compare March 23, 2026 18:31
logonoff and others added 13 commits March 23, 2026 19:12
Replace bare React.lazy() usage with AsyncComponent, which provides
its own Suspense boundary and retry logic. The MenuToggle icon was
missing a Suspense boundary, causing the lazy-loaded perspective icon
to suspend an ancestor boundary and block the entire app content from
rendering when concurrent features are enabled via createRoot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
this allows the blame to be shifted away from "contextProviderExtensions suspense", so we know if it is a contextProviderExtensions suspending or if it is the AppContent as a whole
Firehose is a class component that uses legacy patterns incompatible
with createRoot's concurrent rendering model. The tests rely on
synchronous rendering behavior (enzyme mount with act()) that breaks
under createRoot. The Firehose component itself still functions at
runtime, but the test infrastructure cannot exercise it correctly
with createRoot.

These tests should be re-enabled when Firehose is either refactored
to use hooks or replaced with useK8sWatchResources in the remaining
call sites.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
react-redux 9.x warns when selectors return new references on every
call with the same state. Fix selectors that created new objects via
.toJS(), ?? {}, new Date(), object literal returns, or .toObject()
by using createSelector, shallowEqual, useMemo, or module-level
constants as appropriate.

The createSelector memoization in useK8sModels now returns the same
JS object reference when the underlying immutable data hasn't
changed. Update tests to assert stable references instead of
expecting new objects on every render.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Derive activeTabId directly from URL params instead of syncing state
via useEffect. The previous pattern caused a feedback loop under
concurrent rendering: clicking a tab set state immediately, but the
useEffect reset it to the stale URL value before the navigation
took effect, producing a visible flicker.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The useEffect syncing activeNamespace from the URL had
activeNamespace in its dependency array, creating a feedback loop:
switching namespace set state immediately, but the effect re-fired
before the URL updated and reset to the old value.

Stabilize updateNamespace with useCallback and refs so it does not
change identity on every render. This removes all three
eslint-disable react-hooks/exhaustive-deps suppressions and
provides correct dependency arrays throughout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
setHealthCheck was called directly during render, dispatching to the
parent's useReducer and triggering an immediate re-render cycle.
React 18's createRoot is stricter about setState during render and
detects this as an infinite loop.

Move the call into a useEffect so it only runs after render when the
computed values actually change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
setLimitReqState was called directly during render, dispatching to
the parent's useReducer and triggering an infinite re-render cycle.
Move the call into a useEffect so it only fires when the computed
limit/requested states change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dispatch({ type: ActionType.OBJ }) was called directly during render
to sync the obj prop into reducer state. Move it into a useEffect
to avoid infinite re-render cycles under concurrent rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
setHasRevealableContent was called inside useMemo, which is setState
during render. With createRoot this caused re-render cycles that
prevented the reveal state from stabilizing, so the E2E test read
"Value hidden" instead of the decoded secret value.

Derive hasRevealableContent as a useMemo instead of useState, since
it only depends on the data prop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@logonoff logonoff force-pushed the CONSOLE-5073-shared-modules branch from efea63c to 50790d4 Compare March 23, 2026 23:39
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 24, 2026

@logonoff: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console 50790d4 link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/helm Related to helm-plugin component/knative Related to knative-plugin component/monitoring Related to monitoring component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing kind/demo-plugin Related to dynamic-demo-plugin kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants