Skip to content

feat: react router v6#1013

Merged
arunjaindev merged 6 commits into
feat/react-18from
feat/react-router-v6
Mar 2, 2026
Merged

feat: react router v6#1013
arunjaindev merged 6 commits into
feat/react-18from
feat/react-router-v6

Conversation

@arunjaindev

Copy link
Copy Markdown
Contributor

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

Copilot AI 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.

Pull request overview

This pull request migrates the codebase from React Router v5 to v6, a major version upgrade with significant breaking changes. The migration introduces a new centralized routing structure (ROUTER_URLS), updates all routing-related hooks and components, and includes related changes like migrating from ReactDOM.render to ReactDOM.createRoot.

Changes:

  • Upgraded react-router-dom from v5.3.0 to v6.30.3
  • Created new ROUTER_URLS constants structure in Pages-Devtron-2.0/Shared/Routes/
  • Migrated from Switch to Routes, Redirect to Navigate, useHistory to useNavigate, and useRouteMatch to useParams/generatePath
  • Updated NavLink className to use function signature with isActive parameter
  • Replaced Prompt component with useBlocker hook
  • Migrated ReactDOM.render to ReactDOM.createRoot
  • Updated breadcrumb components to work with new routing patterns

Reviewed changes

Copilot reviewed 90 out of 91 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
package.json Upgraded react-router-dom dependency from v5 to v6
src/Pages-Devtron-2.0/Shared/Routes/routes.ts New centralized routing constants structure (ROUTER_URLS)
src/Shared/Hooks/UsePrompt/UsePrompt.tsx Replaced Prompt with useBlocker hook for route blocking
src/Shared/Components/CICDHistory/TriggerOutput.tsx Migrated Switch to Routes, updated Route syntax with element prop
src/Shared/Components/CICDHistory/Sidebar.tsx Replaced useHistory with useNavigate, useRouteMatch with useParams
src/Common/BreadCrumb/BreadCrumb.tsx Updated useBreadcrumb hook to use generatePath and accept pathPattern parameter
src/Shared/Components/CodeEditor/utils.tsx Migrated ReactDOM.render to createRoot
src/Shared/Components/TreeView/TreeView.component.tsx Updated NavLink className to function signature
src/Common/Constants.ts Deprecated URLS constant in favor of ROUTER_URLS
Multiple type files Changed interface to type for parameter types (formatting changes)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Shared/Components/Charts/plugins.tsx Outdated
}
}, [handlePageLeave])

const blocker = useBlocker(shouldPrompt)

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

The useBlocker hook should receive a function that returns a boolean, not a boolean value directly. In React Router v6, useBlocker expects a function like useBlocker(() => shouldPrompt) or a function that evaluates the blocking condition. Passing a boolean directly may not work as expected.

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +60
useEffect(() => {
if (blocker.state !== 'blocked') {
return
}

// eslint-disable-next-line no-alert
const proceed = window.confirm(message)

if (proceed) {
blocker.proceed()
} else {
blocker.reset()
}
}, [blocker, message])

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

The blocker state check and window.confirm logic should be wrapped in a check to ensure blocker is defined. There may be edge cases where blocker.state could throw an error if blocker is not properly initialized. Consider adding a null check: if (!blocker || blocker.state !== 'blocked') or verify that useBlocker always returns a valid object.

Copilot uses AI. Check for mistakes.
Comment thread src/Shared/Components/CICDHistory/TriggerOutput.tsx
Comment thread src/Common/BreadCrumb/BreadCrumb.tsx
Comment thread src/Shared/Components/CICDHistory/TriggerOutput.tsx
Comment thread src/Shared/Components/CICDHistory/TriggerOutput.tsx
Comment thread src/Shared/Components/CICDHistory/Sidebar.tsx
Comment thread src/Shared/Components/CodeEditor/utils.tsx
Comment thread src/Shared/Components/CodeEditor/Extensions/findAndReplace.tsx Outdated

export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
export function useBreadcrumb(pathPattern: string, props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
const sep = props?.sep || '/'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we make params obj?

export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
export function useBreadcrumb(pathPattern: string, props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
const sep = props?.sep || '/'
deps = deps || []

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you check if deps need to be memoized?

@arunjaindev arunjaindev merged commit 90caa7d into feat/react-18 Mar 2, 2026
4 checks passed
@arunjaindev arunjaindev deleted the feat/react-router-v6 branch March 2, 2026 08:35
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.

3 participants