refactor: remove all instances of react-router-dom by paanSinghCoder ¡ Pull Request #1410 ¡ raystack/frontier
No actionable comments were generated in the recent review. đ
âšī¸ Recent review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
â Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
đ Files selected for processing (1)
web/sdk/admin/views/preferences/columns.tsx
đ§ Files skipped from review as they are similar to previous changes (1)
- web/sdk/admin/views/preferences/columns.tsx
đ Walkthrough
Summary by CodeRabbit
-
New Features
- Improved navigation experience across admin pages for organizations, plans, preferences, and users.
-
Refactor
- Refactored navigation system to use callback-based patterns for better component flexibility.
- Updated list view components with enhanced interactivity across admin panels.
- Removed router dependency from SDK package to decouple component architecture.
Walkthrough
This PR removes direct react-router-dom coupling from admin SDK views and pages by replacing Link/NavLink/useNavigate usage with optional callback props (onNavigateToOrg, onSelectPlan, onSelectPreference, onNavigate, onNavigateToUser). Pages supply navigation handlers; react-router-dom was removed from the SDK peerDependencies.
Changes
| Cohort / File(s) | Summary |
|---|---|
Admin Pages web/apps/admin/src/pages/admins/AdminsPage.tsx, web/apps/admin/src/pages/plans/PlansPage.tsx, web/apps/admin/src/pages/preferences/PreferencesPage.tsx, web/apps/admin/src/pages/users/UsersPage.tsx |
Pages now use react-router hooks and pass navigation callbacks/props (onNavigateToOrg, onSelectPlan, onSelectPreference, currentPath/onNavigate) into view components. |
Admins View web/sdk/admin/views/admins/index.tsx, web/sdk/admin/views/admins/columns.tsx |
Added AdminsViewProps with optional onNavigateToOrg; getColumns accepts options and Organization cell uses clickable Text invoking onNavigateToOrg instead of Link. |
Plans View web/sdk/admin/views/plans/index.tsx, web/sdk/admin/views/plans/columns.tsx |
Added onSelectPlan prop to PlansViewProps; getColumns accepts options and ID column uses Text with onSelectPlan callback instead of Link. |
Preferences View web/sdk/admin/views/preferences/PreferencesView.tsx, web/sdk/admin/views/preferences/columns.tsx, web/sdk/admin/views/preferences/index.tsx |
Added onSelectPreference prop; getColumns accepts options and Action/Edit uses clickable Text invoking onSelectPreference instead of Link. |
Users View - Main & List web/sdk/admin/views/users/UsersView.tsx, web/sdk/admin/views/users/list/columns.tsx, web/sdk/admin/views/users/list/list.tsx |
UsersView gained currentPath and onNavigate props; list columns accept onNavigateToUser and render clickable user cell invoking callback instead of Link; list passes through onNavigateToUser. |
Users View - Details & Layout web/sdk/admin/views/users/details/user-details.tsx, web/sdk/admin/views/users/details/layout/layout.tsx, web/sdk/admin/views/users/details/layout/navbar.tsx |
Threaded currentPath and onNavigate through UserDetails components; navbar replaced NavLink usage with Chip items using currentPath to determine active state and onNavigate for clicks. |
Webhooks Views web/sdk/admin/views/webhooks/webhooks/create/index.tsx, web/sdk/admin/views/webhooks/webhooks/header.tsx, web/sdk/admin/views/webhooks/webhooks/update/index.tsx |
Removed useNavigate usage and fallback navigation; handlers now rely solely on provided callbacks (onOpenCreate/onCloseProp) and no longer navigate by default. |
SDK package config web/sdk/package.json |
Removed react-router-dom from peerDependencies and peerDependenciesMeta, decoupling SDK from direct router dependency. |
Estimated code review effort
đ¯ 4 (Complex) | âąī¸ ~60 minutes
Possibly related PRs
- fix: empty outlet in admin org routes #1407: Similar refactor moving routing out of SDK/views and consolidating navigation in the app layer.
- feat: export Roles page as a component and consume it in apps/admin #1349: Same pattern of making admin views router-agnostic by adding navigation callback props and moving navigation into pages.
- feat: export admin page as a component and consume it in apps/admin #1375: Directly related to AdminsPage/AdminsView wiring changes that add onNavigateToOrg and adjust view/page integration.
Suggested reviewers
- rsbh
- rohanchkrabrty
- rohilsurana
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.
Comment @coderabbitai help to get the list of available commands and usage tips.