Skip to content

CONSOLE-4990: Replace history object navigation with useNavigate hook#15959

Open
rhamilto wants to merge 8 commits intoopenshift:mainfrom
rhamilto:CONSOLE-4990-programmatic-navigation
Open

CONSOLE-4990: Replace history object navigation with useNavigate hook#15959
rhamilto wants to merge 8 commits intoopenshift:mainfrom
rhamilto:CONSOLE-4990-programmatic-navigation

Conversation

@rhamilto
Copy link
Member

@rhamilto rhamilto commented Jan 29, 2026

Summary

This PR completes the migration from the deprecated history object to React Router's useNavigate hook across all remaining packages in the OpenShift Console frontend.

Changes

This PR migrates all remaining instances of the deprecated history object to use the useNavigate hook from react-router-dom-v5-compat, except for:

  • public/components/app.tsx (will be handled in CONSOLE-4392)
  • public/components/factory/modal.tsx (will be handled in CONSOLE-5012)

Packages Migrated

  1. console-app

    • Updated navigation patterns to use useNavigate hook
  2. console-shared

    • Updated navigation patterns to use useNavigate hook
    • ErrorBoundary fix: Changed from using location.pathname as a key prop (which caused component remounting on every URL change) to passing it as a regular prop and using componentDidUpdate to reset error state only when there's an active error AND the location changes. This prevents unnecessary component remounting during tab navigation.
  3. dev-console

    • ProjectAccess.tsx: Replace history.goBack with navigate(-1)
    • ProjectAccess.spec.tsx: Updated test mocks (removed obsolete history mock, added useNavigate mock)
  4. knative-plugin

    • DeleteRevisionModalController.tsx: Replace history.push() with navigate()
  5. helm-plugin

    • Updated navigation patterns to use useNavigate hook
  6. operator-lifecycle-manager

    • create-catalog-source.tsx: Replace history.goBack with navigate(-1)
    • operator-hub-items.tsx: Replace history.replace with navigate
    • operator-hub-subscribe.tsx: Replace history.push with navigate
    • install-plan.tsx: Replace history.push with navigate
    • uninstall-operator-modal.tsx: Replace history.push with navigate
    • operand-form.tsx: Replace history.push/replace/goBack with navigate equivalents
    • DEPRECATED_operand-form.tsx: Replace history.push/goBack with navigate equivalents
    • subscription.tsx: Replace history.push with navigate
  7. metal3-plugin

    • AddBareMetalHost.tsx: Replace history.push() with navigate()
  8. public/components

    • attach-storage.tsx: Removed unused history: History type definition

Test Updates

  • Updated ProjectAccess.spec.tsx to remove the obsolete history mock and add proper useNavigate mock

Migration Patterns Used

All migrations follow the established patterns:

  • history.push(path)navigate(path)
  • history.replace(path)navigate(path, { replace: true })
  • history.goBack()navigate(-1)
  • Added useNavigate() hook imports from react-router-dom-v5-compat
  • Updated component implementations to use the navigate function

Commit Structure

The commits are organized by package for easier review:

  1. CONSOLE-4990: Migrate console-app to useNavigate hook
  2. CONSOLE-4990: Migrate console-shared to useNavigate hook
  3. CONSOLE-4990: Migrate dev-console to useNavigate hook
  4. CONSOLE-4990: Migrate knative-plugin to useNavigate hook
  5. CONSOLE-4990: Migrate helm-plugin to useNavigate hook
  6. CONSOLE-4990: Migrate operator-lifecycle-manager to useNavigate hook
  7. CONSOLE-4990: Migrate remaining packages to useNavigate hook
  8. CONSOLE-4990: Replace history types with React Router types

Bug Fix

Fixed resource tab navigation causing full page reloads (#15959 (comment))

The ErrorBoundary component was using location.pathname as a key prop, which caused the entire component tree to remount whenever the URL changed. This resulted in:

  • Components unmounting and remounting when switching between resource tabs (Details → YAML → Events)
  • Unnecessary data refetching
  • Loss of component state

Solution: Changed to pass locationPathname as a prop and use componentDidUpdate to reset error state only when there's an active error AND the location changes. This preserves the error reset behavior while avoiding unnecessary remounts.

Related Issues

Testing

  • All modified components have been updated to use useNavigate() hook
  • Test file updated to properly mock the new hook
  • No functional changes to navigation behavior
  • All existing navigation patterns preserved
  • ErrorBoundary tests pass with new implementation

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

@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 Jan 29, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 29, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 29, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 29, 2026

@rhamilto: This pull request references CONSOLE-4990 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:

Summary

Migrates all programmatic navigation from the deprecated history object to the React Router v6/v7 compatible useNavigate hook as part of the React Router v7 upgrade effort.

Epic: CONSOLE-4392 - Upgrade to react-router v7

Related PR: #15956 (Query parameter management migration)

Changes Overview

This PR migrates 54 files across 9 packages, organized into 6 commits by package for easier review.

Migration Pattern

Before:

import { history } from '@console/internal/components/utils/router';

const MyComponent = () => {
 const navigate = () => history.push('/path');
 const goBack = () => history.goBack();
 return <button onClick={navigate}>Navigate</button>;
};

After:

import { useNavigate } from 'react-router-dom-v5-compat';

const MyComponent = () => {
 const navigate = useNavigate();
 const handleNavigate = () => navigate('/path');
 const goBack = () => navigate(-1);
 return <button onClick={handleNavigate}>Navigate</button>;
};

Changes by Package

1. console-app (9 files)

  • cronjob-factory.ts - Converted to dependency injection pattern
  • cronjob-provider.ts - Use navigate in action creator
  • 7 component files - Standard migration pattern

Key Pattern: Dependency injection for action creators

2. console-shared (8 files)

  • error-boundary.tsx - Used key prop pattern for location-based reset
  • catalog-utils.tsx - Utility file with parameter injection
  • 6 component files - Standard migration pattern

Key Patterns:

  • Key prop for class component reset on navigation
  • Parameter injection for utility functions

3. dev-console (17 files)

  • import-submit-utils.ts - Updated to accept NavigateFunction
  • jar-file-upload-utils.ts - Utility with parameter injection
  • add-page-utils.ts - Utility with parameter injection
  • 14 component files - Standard migration pattern

Key Pattern: Dependency injection for shared utility functions

4. knative-plugin (8 files)

  • create-eventsources-utils.ts - Utility with parameter injection
  • 7 component files - Standard migration pattern

5. helm-plugin (5 files)

  • All component files - Standard migration pattern

6. Other packages (6 files)

  • operator-lifecycle-manager (2 files)
  • topology (1 file)
  • shipwright-plugin (1 file)
  • metal3-plugin (1 file)
  • public (1 file)

Replacements Made

  • history.push(path)navigate(path)
  • history.replace(path)navigate(path, { replace: true })
  • history.goBack()navigate(-1)

Testing

  • ✅ TypeScript compilation: 0 errors
  • ✅ ESLint pre-commit hooks: Passing for all commits
  • ✅ No remaining history imports for programmatic navigation
  • ✅ All 54 files successfully migrated

What Remains

The history object export is intentionally kept in router.ts as it's still used by:

  • Router component initialization in app.tsx
  • Monkey-patching for base path handling (removeBasePath)
  • Will be removed in a future PR as part of the final React Router v7 migration

Commit Structure

Each commit is scoped to a single package for easier review:

  1. CONSOLE-4990: Migrate console-app to useNavigate hook
  2. CONSOLE-4990: Migrate console-shared to useNavigate hook
  3. CONSOLE-4990: Migrate dev-console to useNavigate hook
  4. CONSOLE-4990: Migrate knative-plugin to useNavigate hook
  5. CONSOLE-4990: Migrate helm-plugin to useNavigate hook
  6. CONSOLE-4990: Migrate remaining packages to useNavigate hook

Related Issues

Part of CONSOLE-4392 - React Router v7 upgrade epic

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 openshift-ci bot added the component/core Related to console core functionality label Jan 29, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 29, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto

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 openshift-ci bot added component/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/helm Related to helm-plugin component/knative Related to knative-plugin component/metal3 Related to metal3-plugin component/olm Related to OLM component/shared Related to console-shared component/topology Related to topology labels Jan 29, 2026
@rhamilto rhamilto changed the title CONSOLE-4990: Replace history object navigation with useNavigate hook [WIP] CONSOLE-4990: Replace history object navigation with useNavigate hook Jan 29, 2026
@rhamilto rhamilto marked this pull request as ready for review January 29, 2026 19:07
@openshift-ci openshift-ci bot requested review from jhadvig and rawagner January 29, 2026 19:08
@rhamilto rhamilto force-pushed the CONSOLE-4990-programmatic-navigation branch from fab6845 to 4c78f4b Compare January 29, 2026 21:55
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jan 29, 2026

@rhamilto: This pull request references CONSOLE-4990 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:

Summary

Migrates all programmatic navigation from the deprecated history object to the React Router v6/v7 compatible useNavigate hook as part of the React Router v7 upgrade effort.

Epic: CONSOLE-4392 - Upgrade to react-router v7

Changes Overview

This PR migrates 81 files across multiple packages, organized into 7 commits by package for easier review.

Migration Patterns

1. Basic Navigation Migration

Before:

import { history } from '@console/internal/components/utils/router';

const MyComponent = () => {
 const navigate = () => history.push('/path');
 const goBack = () => history.goBack();
 return <button onClick={navigate}>Navigate</button>;
};

After:

import { useNavigate } from 'react-router-dom-v5-compat';
import { useCallback } from 'react';

const MyComponent = () => {
 const navigate = useNavigate();
 const handleNavigate = useCallback(() => navigate('/path'), [navigate]);
 const handleCancel = useCallback(() => navigate(-1), [navigate]);
 return <button onClick={handleNavigate}>Navigate</button>;
};

2. Utility Function Pattern (Dependency Injection)

Before:

import { history } from '@console/internal/components/utils/router';

export const navigateToResource = (path: string) => {
 history.push(path);
};

After:

type NavigateFunction = (to: string, options?: { replace?: boolean }) => void;

export const navigateToResource = (path: string, navigate: NavigateFunction) => {
 navigate(path);
};

3. Query Parameter Management

All query parameter mutations now use the new useQueryParamsMutator hook (introduced in the first commit):

const { getQueryArgument, setQueryArgument, removeQueryArgument } = useQueryParamsMutator();

Key Improvements

Performance Optimization: All navigation callbacks properly wrapped in useCallback to prevent unnecessary re-renders
Dependency Injection: Utility functions accept navigate as a parameter for better testability
Type Safety: Proper TypeScript typing with NavigateFunction throughout
Comprehensive Testing: 251 lines of tests for the new useQueryParamsMutator hook

Changes by Commit

1. 9215732b94 - Core Infrastructure Migration

  • New Hook: useQueryParamsMutator with comprehensive API
  • Test Coverage: 251 lines of unit tests
  • Pattern: Functional wrapper for class components (PodLogs)
  • Files: 8 core files including router utilities

2. 0b76e669fc - console-app Migration

  • Files: 12 files
  • Key Pattern: Dependency injection for cronjob-factory
  • New Hook: Foundation for useCronJobActions (completed in commit 7)

3. d39392028f - console-shared Migration

  • Files: 13 files
  • Key Patterns:
  • Key prop for ErrorBoundary reset on navigation
  • Parameter injection for catalog utilities
  • All callbacks properly memoized with useCallback

4. 7ba04a6760 - dev-console Migration

  • Files: 18 files
  • Key Pattern: Dependency injection for import/jar utilities
  • Consistency: All form cancel handlers use useCallback(() => navigate(-1), [navigate])

5. 85e900fdbe - knative-plugin Migration

  • Files: 8 files
  • Key Pattern: Dependency injection for create-eventsources-utils
  • Consistency: All callbacks properly wrapped in useCallback

6. def35a3651 - helm-plugin Migration

  • Files: 5 files
  • Key Pattern: Complex navigation logic with multiple paths
  • Consistency: All callbacks properly wrapped in useCallback

7. 4c78f4b1d0 - Remaining Packages + Advanced Patterns

  • Files: 10 files
  • New Hook: useCronJobActions with excellent design patterns
  • Packages: operator-lifecycle-manager, topology, shipwright, metal3, public
  • Advanced: Refactored operator-hub-items to use useQueryParamsMutator

Replacements Made

  • history.push(path)navigate(path)
  • history.replace(path)navigate(path, { replace: true })
  • history.goBack()navigate(-1)
  • All inline navigation callbacks → wrapped in useCallback with proper dependencies

Code Quality

Consistent Patterns: All 81 files follow the same migration patterns
useCallback Usage: Every navigation callback properly memoized
Dependency Arrays: All callbacks have correct dependency arrays
Type Safety: Proper TypeScript types throughout
Documentation: JSDoc for complex hooks (e.g., useCronJobActions)
Testing: Comprehensive test coverage for new utilities

Testing

  • ✅ TypeScript compilation: 0 errors
  • ✅ ESLint pre-commit hooks: Passing for all commits
  • ✅ All useCallback dependencies validated by react-hooks/exhaustive-deps
  • ✅ Unit tests: 251 lines of comprehensive tests for useQueryParamsMutator
  • ✅ All 81 files successfully migrated

What Remains

The history object export is intentionally kept in router.ts as it's still used by:

  • Router component initialization in app.tsx
  • Monkey-patching for base path handling (removeBasePath)
  • Legacy getQueryArgument function (marked @deprecated, 28+ usages to migrate separately)

These will be removed in future PRs as part of the final React Router v7 migration.

Commit Structure

Each commit is scoped to a package/layer for easier review:

  1. Core Infrastructure: useQueryParamsMutator hook + tests
  2. console-app: Action creators and components
  3. console-shared: Shared utilities and components
  4. dev-console: Developer console package
  5. knative-plugin: Knative serverless plugin
  6. helm-plugin: Helm chart plugin
  7. Remaining packages: operator-lifecycle-manager, topology, shipwright, metal3, public

Review Notes

This migration has been thoroughly reviewed for:

  • ✅ Correct migration patterns
  • ✅ useCallback consistency and correctness
  • ✅ Dependency injection for utilities
  • ✅ Type safety
  • ✅ Performance optimization
  • ✅ Test coverage

Status: Ready for final review and merge

Related Issues

Part of CONSOLE-4392 - React Router v7 upgrade epic

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.

@rhamilto rhamilto changed the title [WIP] CONSOLE-4990: Replace history object navigation with useNavigate hook CONSOLE-4990: Replace history object navigation with useNavigate hook Jan 29, 2026
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 29, 2026
@rhamilto rhamilto changed the title CONSOLE-4990: Replace history object navigation with useNavigate hook [WIP] CONSOLE-4990: Replace history object navigation with useNavigate hook Jan 29, 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 Jan 29, 2026
@rhamilto rhamilto force-pushed the CONSOLE-4990-programmatic-navigation branch 2 times, most recently from 738897a to b7a45bf Compare January 29, 2026 22:06
@openshift-ci openshift-ci bot added the kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated label Jan 29, 2026
@rhamilto rhamilto changed the title [WIP] CONSOLE-4990: Replace history object navigation with useNavigate hook CONSOLE-4990: Replace history object navigation with useNavigate hook Jan 29, 2026
@rhamilto
Copy link
Member Author

rhamilto commented Feb 9, 2026

Test File Removed

Removed BuildConfigFormPage.spec.tsx from the dev-console commit as it contained pre-existing test failures unrelated to the navigation migration:

  • The test was already failing before my changes (checking for "Configure via:", "Form view", "YAML view" text that wasn't being rendered)
  • I didn't actually make any changes to this test file - the changes were just linter formatting
  • The failing test should be fixed separately in its own PR

The test file has been reverted to its original state and is no longer part of this PR.

@rhamilto
Copy link
Member Author

rhamilto commented Feb 9, 2026

/retest

@yapei
Copy link
Contributor

yapei commented Feb 10, 2026

It looks like we should not reload everything when switching between resource tabs(this issue is not reproducible on 4.22.0-0.ci-2026-02-09-205844)

console-reload-on-switching-tabs.mov

Replace history object usage with useNavigate hook in console-shared package.

Changes:
- ActionMenuItem.tsx: Replace history.push with navigate
- CatalogTile.tsx: Replace history.push with navigate
- CatalogView.tsx: Replace history.push with navigate
- catalog-utils.tsx: Accept NavigateFunction as parameter
- dynamic-form/index.tsx: Replace history.goBack with navigate(-1)
- error-boundary.tsx: Use componentDidUpdate instead of key prop for location-based reset
- DeleteResourceModal.tsx: Replace history.push with navigate
- MultiTabListPage.tsx: Replace history.push with navigate

Migration patterns:
- Components: Added useNavigate() hook
- Utilities: Parameter injection for NavigateFunction
- ErrorBoundary: Pass locationPathname as prop and use componentDidUpdate to reset
  error state only when there's an active error AND location changes. This avoids
  unnecessary component remounting during tab navigation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rhamilto rhamilto force-pushed the CONSOLE-4990-programmatic-navigation branch from 057efc3 to 3f29d8e Compare February 10, 2026 13:34
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 10, 2026

@rhamilto: This pull request references CONSOLE-4990 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:

Summary

This PR completes the migration from the deprecated history object to React Router's useNavigate hook across all remaining packages in the OpenShift Console frontend.

Changes

This PR migrates all remaining instances of the deprecated history object to use the useNavigate hook from react-router-dom-v5-compat, except for:

  • public/components/app.tsx (will be handled in CONSOLE-4392)
  • public/components/factory/modal.tsx (will be handled in CONSOLE-5012)

Packages Migrated

  1. console-app
  • Updated navigation patterns to use useNavigate hook
  1. console-shared
  • Updated navigation patterns to use useNavigate hook
  • ErrorBoundary fix: Changed from using location.pathname as a key prop (which caused component remounting on every URL change) to passing it as a regular prop and using componentDidUpdate to reset error state only when there's an active error AND the location changes. This prevents unnecessary component remounting during tab navigation.
  1. dev-console
  • ProjectAccess.tsx: Replace history.goBack with navigate(-1)
  • ProjectAccess.spec.tsx: Updated test mocks (removed obsolete history mock, added useNavigate mock)
  1. knative-plugin
  • DeleteRevisionModalController.tsx: Replace history.push() with navigate()
  1. helm-plugin
  • Updated navigation patterns to use useNavigate hook
  1. operator-lifecycle-manager
  • create-catalog-source.tsx: Replace history.goBack with navigate(-1)
  • operator-hub-items.tsx: Replace history.replace with navigate
  • operator-hub-subscribe.tsx: Replace history.push with navigate
  • install-plan.tsx: Replace history.push with navigate
  • uninstall-operator-modal.tsx: Replace history.push with navigate
  • operand-form.tsx: Replace history.push/replace/goBack with navigate equivalents
  • DEPRECATED_operand-form.tsx: Replace history.push/goBack with navigate equivalents
  • subscription.tsx: Replace history.push with navigate
  1. metal3-plugin
  • AddBareMetalHost.tsx: Replace history.push() with navigate()
  1. public/components
  • attach-storage.tsx: Removed unused history: History type definition

Test Updates

  • Updated ProjectAccess.spec.tsx to remove the obsolete history mock and add proper useNavigate mock

Migration Patterns Used

All migrations follow the established patterns:

  • history.push(path)navigate(path)
  • history.replace(path)navigate(path, { replace: true })
  • history.goBack()navigate(-1)
  • Added useNavigate() hook imports from react-router-dom-v5-compat
  • Updated component implementations to use the navigate function

Commit Structure

The commits are organized by package for easier review:

  1. CONSOLE-4990: Migrate console-app to useNavigate hook
  2. CONSOLE-4990: Migrate console-shared to useNavigate hook
  3. CONSOLE-4990: Migrate dev-console to useNavigate hook
  4. CONSOLE-4990: Migrate knative-plugin to useNavigate hook
  5. CONSOLE-4990: Migrate helm-plugin to useNavigate hook
  6. CONSOLE-4990: Migrate operator-lifecycle-manager to useNavigate hook
  7. CONSOLE-4990: Migrate remaining packages to useNavigate hook
  8. CONSOLE-4990: Replace history types with React Router types

Bug Fix

Fixed resource tab navigation causing full page reloads (#15959 (comment))

The ErrorBoundary component was using location.pathname as a key prop, which caused the entire component tree to remount whenever the URL changed. This resulted in:

  • Components unmounting and remounting when switching between resource tabs (Details → YAML → Events)
  • Unnecessary data refetching
  • Loss of component state

Solution: Changed to pass locationPathname as a prop and use componentDidUpdate to reset error state only when there's an active error AND the location changes. This preserves the error reset behavior while avoiding unnecessary remounts.

Related Issues

Testing

  • All modified components have been updated to use useNavigate() hook
  • Test file updated to properly mock the new hook
  • No functional changes to navigation behavior
  • All existing navigation patterns preserved
  • ErrorBoundary tests pass with new implementation

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

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.

@rhamilto
Copy link
Member Author

rhamilto commented Feb 10, 2026

Bug Fix Applied

I've fixed the issue reported by @yapei where switching between resource tabs was causing everything to reload.

Root Cause: The ErrorBoundary component was using location.pathname as a key prop, which forced React to unmount and remount the entire component tree on every URL change - including simple tab navigation.

Fix: Changed the implementation to pass locationPathname as a regular prop and use componentDidUpdate to conditionally reset error state only when:

  1. There's an active error (hasError is true), AND
  2. The location has actually changed

This preserves the error reset behavior while avoiding unnecessary component remounting.

Changes: The fix has been squashed into commit eb60ed333e (CONSOLE-4990: Migrate console-shared to useNavigate hook) so all error-boundary changes remain in a single commit.

All tests pass ✅

@rhamilto
Copy link
Member Author

It looks like we should not reload everything when switching between resource tabs(this issue is not reproducible on 4.22.0-0.ci-2026-02-09-205844)

Great catch, @yapei! I believe this is fixed.

Screen.Recording.2026-02-10.at.8.33.42.AM.mov

@rhamilto
Copy link
Member Author

/retest

@yapei
Copy link
Contributor

yapei commented Feb 11, 2026

thanks for the fix @rhamilto I also confirmed it's working now
/verified by @yapei

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 11, 2026
@openshift-ci-robot
Copy link
Contributor

@yapei: This PR has been marked as verified by @yapei.

Details

In response to this:

thanks for the fix @rhamilto I also confirmed it's working now
/verified by @yapei

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.

rhamilto and others added 6 commits February 11, 2026 07:18
Replace history object usage with useNavigate hook in dev-console package.

Changes:
- AddCardItem.tsx: Pass navigate to navigateTo utility
- EditBuildConfig.tsx: Replace history.push with navigate
- EditDeployment.tsx: Replace history.push with navigate
- EditApplication.tsx: Replace history.goBack with navigate(-1)
- AddHealthChecks.tsx: Replace history.push with navigate
- AddHealthChecksForm.tsx: Replace history.goBack with navigate(-1)
- HPAFormikForm.tsx: Replace history.goBack with navigate(-1)
- DeployImage.tsx: Pass navigate to handleRedirect
- ImportForm.tsx: Pass navigate to handleRedirect
- ImportSamplePage.tsx: Pass navigate to handleRedirect
- import-submit-utils.ts: Accept NavigateFunction parameter
- UploadJar.tsx: Replace history.goBack with navigate(-1)
- useUploadJarFormToast.ts: Accept navigate as parameter
- AddServerlessFunction.tsx: Replace history.goBack with navigate(-1)
- jar-file-upload-utils.ts: Accept navigate as parameter
- MonitoringPage.tsx: Replace history.push with navigate
- ProjectDetailsPage.tsx: Replace history.push with navigate
- add-page-utils.ts: Accept navigate as parameter

All utility functions updated to use dependency injection pattern.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace history object usage with useNavigate hook in knative-plugin package.

Changes:
- EventSink.tsx: Replace history.goBack with navigate(-1)
- EventSource.tsx: Replace history.goBack with navigate(-1)
- AddBroker.tsx: Replace history.goBack with navigate(-1)
- AddChannel.tsx: Replace history.goBack with navigate(-1)
- Subscribe.tsx: Replace history.push with navigate
- FunctionDetailsPage.tsx: Replace history.push with navigate
- CreateKnatifyPage.tsx: Replace history.goBack with navigate(-1)
- create-eventsources-utils.ts: Accept NavigateFunction parameter

All components updated to use useNavigate() hook.
Utility function updated to use dependency injection pattern.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace history object usage with useNavigate hook in helm-plugin package.

Changes:
- HelmReleaseDetailsPage.tsx: Replace history.push with navigate
- CreateHelmChartRepository.tsx: Replace history.goBack with navigate(-1)
- CreateHelmChartRepositoryPage.tsx: Replace history.push with navigate
- HelmInstallUpgradePage.tsx: Replace history.push/goBack with navigate
- HelmReleaseRollbackPage.tsx: Replace history.push/goBack with navigate

All components updated to use useNavigate() hook from react-router-dom-v5-compat.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace history object usage with useNavigate hook in operator-lifecycle-manager package.

Changes:
- create-catalog-source.tsx: Replace history.goBack with navigate(-1)
- operator-hub-items.tsx: Replace history.replace with navigate
- operator-hub-subscribe.tsx: Replace history.push with navigate
- install-plan.tsx: Replace history.push with navigate
- uninstall-operator-modal.tsx: Replace history.push with navigate
- operand-form.tsx: Replace history.push/replace/goBack with navigate
- DEPRECATED_operand-form.tsx: Replace history.push/goBack with navigate
- subscription.tsx: Replace history.push with navigate

All components updated to use useNavigate() hook from react-router-dom-v5-compat.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace history object usage with useNavigate hook in remaining packages.

Changes:
- topology/ExportViewLogButton.tsx: Replace history.push with navigate
- shipwright-plugin/EditBuild.tsx: Replace history.push/goBack with navigate
- metal3-plugin/AddBareMetalHost.tsx: Replace history.push with navigate
- metal3-plugin/AddBareMetalHostForm.tsx: Replace history.goBack with navigate(-1)
- public/QuickCreate.tsx: Replace history.push with navigate
- public/attach-storage.tsx: Remove unused history type definition

All components updated to use useNavigate() hook from react-router-dom-v5-compat.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace `LocationDescriptor` and `Location` types from the history
package with `To` and `Location` types from react-router-dom-v5-compat.
This is part of the migration to programmatic navigation using React
Router hooks instead of the history object.

Changes:
- Replace LocationDescriptor with To in console-types.ts (SDK)
- Replace LocationDescriptor with To in delete-modal.tsx
- Replace History.LocationDescriptor with To in LinkStatus.tsx
- Replace Location import in telemetry.ts

Breaking Change: The UseDeleteModal hook's redirectTo parameter type
has changed from LocationDescriptor (history) to To (react-router-dom).
Plugin developers should update their imports accordingly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rhamilto rhamilto force-pushed the CONSOLE-4990-programmatic-navigation branch from 3f29d8e to 2f4ced5 Compare February 11, 2026 12:19
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Feb 11, 2026
@rhamilto
Copy link
Member Author

Pushed a test fix.
/verified

@openshift-ci-robot
Copy link
Contributor

@rhamilto: The /verified command must be used with one of the following actions: by, later, remove, or bypass. See https://docs.ci.openshift.org/docs/architecture/jira/#premerge-verification for more information.

Details

In response to this:

Pushed a test fix.
/verified

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.

@rhamilto
Copy link
Member Author

/verified by @rhamilto

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 11, 2026
@openshift-ci-robot
Copy link
Contributor

@rhamilto: This PR has been marked as verified by @rhamilto.

Details

In response to this:

/verified by @rhamilto

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.

@rhamilto
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 11, 2026

@rhamilto: all tests passed!

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.

@rhamilto
Copy link
Member Author

tech debt
/label px-approved
/label docs-approved
/assign @jhadvig

@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 Feb 12, 2026
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/dev-console Related to dev-console component/helm Related to helm-plugin component/knative Related to knative-plugin component/metal3 Related to metal3-plugin component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared component/topology Related to topology 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/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated plugin-api-changed Categorizes a PR as containing plugin API changes px-approved Signifies that Product Support has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants