[wip] CONSOLE-4512, CONSOLE-5073: React 18, phase 2#16087
[wip] CONSOLE-4512, CONSOLE-5073: React 18, phase 2#16087logonoff wants to merge 13 commits intoopenshift:mainfrom
Conversation
|
@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. DetailsIn response to this:
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. |
|
/label px-approved |
|
@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. DetailsIn response to this:
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. |
📝 WalkthroughWalkthroughThis 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 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsx (1)
27-31: Add defaultuseOLSConfigMockreturn inbeforeEachto strengthen test isolation.Tests at lines 33-36 and 38-41 don't set
useOLSConfigMock, yet rely on it being in a default state. Sincejest.clearAllMocks()preservesmockReturnValueimplementations and only clears call history, tests become order-dependent: if a prior test setsuseOLSConfigMock.mockReturnValue(true), that persists into tests expecting falsy behavior. AddinguseOLSConfigMock.mockReturnValue(false)inbeforeEachremoves 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
⛔ Files ignored due to path filters (1)
frontend/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (16)
frontend/package.jsonfrontend/packages/console-app/src/components/detect-namespace/__tests__/namespace.spec.tsfrontend/packages/console-app/src/components/tour/__tests__/tour-context.spec.tsfrontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.mdfrontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sModels.spec.tsxfrontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResource.spec.tsxfrontend/packages/console-dynamic-plugin-sdk/src/utils/k8s/hooks/__tests__/useK8sWatchResources.spec.tsxfrontend/packages/console-shared/src/components/editor/__tests__/CodeEditorToolbar.spec.tsxfrontend/packages/console-shared/src/hooks/__tests__/useGetUserSettingConfigMap.spec.tsfrontend/packages/console-shared/src/hooks/__tests__/useUser.spec.tsfrontend/packages/console-shared/src/hooks/__tests__/useUserPreference.spec.tsfrontend/packages/console-shared/src/test-utils/unit-test-utils.tsxfrontend/packages/dev-console/src/utils/__tests__/usePerspectiveDetection.spec.tsfrontend/packages/knative-plugin/src/components/add/__tests__/EventSink.spec.tsxfrontend/public/components/utils/__tests__/firehose.spec.tsxfrontend/public/redux.ts
frontend/packages/console-dynamic-plugin-sdk/release-notes/4.22.md
Outdated
Show resolved
Hide resolved
dfa923d to
55b9976
Compare
|
/retest-required |
|
@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. DetailsIn response to this:
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: 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. DetailsIn response to this:
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. |
55b9976 to
0e2c33d
Compare
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@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. DetailsIn response to this:
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. |
0e2c33d to
4dca5de
Compare
dd4bece to
287d571
Compare
|
@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. DetailsIn response to this:
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. |
287d571 to
b2b46dc
Compare
18d8ee0 to
8b6582a
Compare
0cf36e5 to
efea63c
Compare
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>
efea63c to
50790d4
Compare
|
@logonoff: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Depends on #15954, #16096, #16183
react-redux8.1.3 -> 9.2.0redux4.0.4 -> 5.0.1redux-thunk2.4.0 -> 3.1.0Removed
redux-mock-storebecause the recommendation is to use a real store: https://redux.js.org/usage/writing-testsSummary by CodeRabbit