Skip to content

Render additional components next to Routes#3109

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
rawagner:additional_comp_route
Aug 13, 2025
Merged

Render additional components next to Routes#3109
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
rawagner:additional_comp_route

Conversation

@rawagner
Copy link
Member

@rawagner rawagner commented Aug 12, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Ensures auxiliary UI elements render within the routing context, preventing cases where they wouldn’t respond to navigation or route state. Improves reliability across Assisted Installer routes.
  • Refactor

    • Consolidated routes and auxiliary components into a single fragment to streamline structure without changing visible behavior or public APIs.

@openshift-ci openshift-ci bot requested review from ElayAharoni and batzionb August 12, 2025 13:34
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

Walkthrough

Moved additionalComponents rendering inside a React fragment that also wraps the Routes block, ensuring it renders within the router context. No public API or route structure changes.

Changes

Cohort / File(s) Summary of Changes
Router composition update
libs/ui-lib/lib/ocm/components/Routes.tsx
Wrapped Routes in a fragment and relocated additionalComponents inside the fragment so they render within the router context; no API or route structure changes.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant Router
    participant Routes
    participant AdditionalComponents

    App->>Router: Initialize routing context
    Router->>Routes: Render route tree
    Router->>AdditionalComponents: Render inside router context
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Poem

I hopped through paths where links align,
Now extras nest where routers shine.
No signatures stirred, no routes askew—
Just closer hugs to context glue.
Thump-thump! The JSX feels neat,
A carrot-clean, cohesive feat. 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 12, 2025
@rawagner
Copy link
Member Author

/cherry-pick releases/v2.44

@openshift-cherrypick-robot
Copy link
Contributor

@rawagner: once the present PR merges, I will cherry-pick it on top of releases/v2.44 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick releases/v2.44

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
libs/ui-lib/lib/ocm/components/Routes.tsx (3)

41-41: Use an absolute path in Navigate to avoid relative resolution pitfalls

Using a relative target can behave unexpectedly under nested routers or differing current locations. Prefer an absolute path.

Apply this diff:

-        <Route path="*" element={<Navigate to="assisted-installer/clusters" />} />
+        <Route path="*" element={<Navigate to="/assisted-installer/clusters" />} />

43-43: Clarify intended contents of additionalComponents

If any consumer mistakenly passes elements via additionalComponents, they won’t be registered (since they’re outside ). Keep routes in children and use additionalComponents for non-route UI that needs router context (e.g., modals, toasters, portals).

Would you like me to add a brief JSDoc on the prop to document this distinction?


35-41: Deduplicate the clusters base path to reduce typo risk

The string "assisted-installer/clusters" appears in both the route and Navigate. Extracting a constant improves maintainability.

Apply this diff within the block:

-        <Route path="assisted-installer/clusters" element={<Outlet />}>
+        <Route path={CLUSTERS_BASE_PATH} element={<Outlet />}>
@@
-        <Route path="*" element={<Navigate to="/assisted-installer/clusters" />} />
+        <Route path="*" element={<Navigate to={`/${CLUSTERS_BASE_PATH}`} />} />

Add this near the imports (outside the changed block):

const CLUSTERS_BASE_PATH = 'assisted-installer/clusters' as const;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ebf8ed and 3443dbe.

📒 Files selected for processing (1)
  • libs/ui-lib/lib/ocm/components/Routes.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
libs/ui-lib/lib/ocm/components/Routes.tsx (4)
libs/ui-lib/lib/ocm/components/clusters/NewClusterPage.tsx (1)
  • NewClusterPage (46-50)
libs/ui-lib-tests/cypress/views/pages/NewClusterPage.ts (1)
  • NewClusterPage (1-5)
libs/ui-lib/lib/ocm/components/clusters/ClusterPage.tsx (1)
  • ClusterPage (215-222)
libs/ui-lib-tests/cypress/views/pages/ClusterPage.ts (1)
  • ClusterPage (3-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: translation-files
  • GitHub Check: format
  • GitHub Check: tests
  • GitHub Check: unit-tests
  • GitHub Check: circular-deps
  • GitHub Check: lint
🔇 Additional comments (1)
libs/ui-lib/lib/ocm/components/Routes.tsx (1)

33-44: Renders additionalComponents within router context — good change

Moving additionalComponents into the same fragment as Routes ensures they have router context regardless of HistoryRouter usage. This addresses context issues without altering public API.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 13, 2025
@openshift-ci
Copy link

openshift-ci bot commented Aug 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ammont82, rawagner

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-merge-bot openshift-merge-bot bot merged commit 2148d80 into openshift-assisted:master Aug 13, 2025
11 checks passed
@openshift-cherrypick-robot
Copy link
Contributor

@rawagner: new pull request created: #3112

Details

In response to this:

/cherry-pick releases/v2.44

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.

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. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants