Skip to content

Conversation

@codyrancher
Copy link
Member

@codyrancher codyrancher commented Jan 6, 2026

Summary

Fixes #12128
Fixes #16220

Occurred changes and/or fixed issues

We now check to make sure params are present on a route definition before passing it to any $router methods.

Technical notes summary

Sometimes we look up the route definition and sometimes we conditionally send a param if we know they're available.

Areas or cases that should be tested

Any management, global or explorer page should be checked. This was primarily an issue with out navigation sections.

Areas which could experience regressions

Any management, global or explorer page should be checked. This was primarily an issue with out navigation sections.

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

@rancher-ui-project-bot rancher-ui-project-bot bot added this to the v2.15.0 milestone Jan 6, 2026
descending: {
type: Boolean,
required: true
required: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated but there was another warning where we were passing undefined to this. Since there wasn't any related bugs that I found I think it's safe to default to false.

Copy link
Member Author

Choose a reason for hiding this comment

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

It has an issue #16220

Comment on lines +127 to +131
export function findRouteDefinitionByName(router, routeName) {
const routes = router.getRoutes();

return routes.find((r) => r.name === routeName);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I did this in the simplest programmatic way. I didn't find any performance issues so I left it but it would be possible to cashing these in a name-to-route object. We'd have to be careful with extensions which I wanted to avoid unless it becomes necessary.

@codyrancher codyrancher modified the milestones: v2.15.0, v2.14.0 Jan 7, 2026
@codyrancher codyrancher marked this pull request as ready for review January 7, 2026 01:39
@codyrancher codyrancher changed the title Router warnings Fix Console Router invalid param warnings Jan 7, 2026
Copy link
Member

@rak-phillip rak-phillip left a comment

Choose a reason for hiding this comment

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

Testing these changes and everything is looking good. The warnings appear to be resolved across the board. I only have one question before we merge.

Comment on lines +197 to +203

// Having an undefined param can yield a console warning like [Vue Router warn]: Discarded invalid param(s) "namespace" when navigating
if (location && !location.params.namespace) {
delete location.params.namespace;
}

return location;
Copy link
Member

Choose a reason for hiding this comment

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

If I understand, the lack of access to a valid router is what prevents us from using the new filterLocationValidParams() in locations like this, RelatedResource, and LinkName so the manual deletion is needed in these areas. Is that correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

So that would be a reasonable reason for this change but it wasn't the motivation for my choice. In this scenario and the other like it, we know what route we're navigating to and we can adjust the params without having to do a lookup.

If you'd like to be consistent I can look into plumping the router in.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm.. While the consistency might be nice, I don't think it will be worth it if there's a level of effort involved. I think this is good as it is.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm.. While the consistency might be nice, I don't think it will be worth it if there's a level of effort involved. I think this is good as it is.

@codyrancher codyrancher merged commit 99ca5bb into rancher:master Jan 8, 2026
91 of 104 checks passed
@codyrancher codyrancher deleted the router-warnings branch January 8, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants