Skip to content

Convert AllSchedules route tree to react-router v6 Routes - #419

Merged
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/react-router-all-schedules
Jun 15, 2026
Merged

Convert AllSchedules route tree to react-router v6 Routes#419
cigamit merged 2 commits into
ctrliq:mainfrom
blaipr:feature/react-router-all-schedules

Conversation

@blaipr

@blaipr blaipr commented Jun 14, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

Continues the react-router v5 → v6 route-tree migration. Converts the global Schedules screen (AllSchedules) from the v5 <Switch> API to v6 <Routes> via react-router-dom-v5-compat.

UI (no behavior change - same URL, same list):

  • AllSchedules.js: <Switch> -> <Routes> with the /schedules list route using the element prop. AllSchedules renders the shared ScheduleList directly (not the nested Schedules router), so this is a single list route with no entanglement.
  • Test rewritten with renderWithContexts (RTL) to mount at /schedules and assert the list resolves and the breadcrumb config is set.
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • UI
ADDITIONAL INFORMATION
  • Part of the incremental react-router v6 migration; each screen's route tree is independent and converted on its own branch off main.
  • npm --prefix awx/ui run lint clean; screens/Schedule/AllSchedules test passes.

Migrate the global schedules screen from the react-router v5 <Switch> API
to v6 <Routes> via react-router-dom-v5-compat. AllSchedules renders the
shared ScheduleList directly (not the nested Schedules router), so this
is a single list route with no entanglement.

- AllSchedules.js: <Switch> -> <Routes> with the /schedules list route
  using the element prop.
- Rewrite the test with renderWithContexts (RTL) to mount at /schedules
  and assert the list resolves and the breadcrumb config is set.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates the global Schedules screen (AllSchedules) from react-router v5’s <Switch>/<Route> pattern to react-router v6’s <Routes>/<Route> using react-router-dom-v5-compat, and updates the associated test to use RTL’s renderWithContexts.

Changes:

  • Converted AllSchedules route tree from v5 <Switch> to v6 <Routes> with an element route.
  • Rewrote AllSchedules test to mount at /schedules with RTL and assert routed list rendering + breadcrumb config.
  • Added lightweight component mocks to make the test focus on which route branch resolves.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
awx/ui/src/screens/Schedule/AllSchedules.js Switches the screen to a v6 <Routes> route definition using element.
awx/ui/src/screens/Schedule/AllSchedules.test.js Updates the test to RTL + memory history mounting at /schedules and asserts route resolution and breadcrumb props.

Comment thread awx/ui/src/screens/Schedule/AllSchedules.js
Comment thread awx/ui/src/screens/Schedule/AllSchedules.test.js
- The v6 <Routes> only matched /schedules exactly, so a stray sub-path
  (e.g. /schedules/foo) rendered a blank panel; add a catch-all that
  redirects back to /schedules.
- Guard the ScreenHeader-props assertion with a toBeDefined() so a missing
  render fails clearly instead of throwing a TypeError.
@blaipr

blaipr commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Addressed in a3ae435d11: added a catch-all that redirects stray /schedules/* sub-paths back to the list (the v6 <Routes> only matched /schedules exactly), and guarded the ScreenHeader assertion with toBeDefined() so a missing render fails clearly.

@cigamit
cigamit merged commit cc0107e into ctrliq:main Jun 15, 2026
@cigamit cigamit self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants