Open aalves08 opened 1 month ago
https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 has been advised against for years as it's an anti-pattern in routing for many reasons, one of them being reloading the page lose the params
This is so true; we lose parameters on many pages and it is not possible to access them from the URL or reload. It may be worth to suppress the warning (if possible) or either fix the issue.
As far as I can see there's no way to disable the warnings unless we override the error handling and we start to hack the way out for all our cases. This would also require a plan to fix the issue, as it will probably be enforced or broken with updates.
@codyrancher also mentioned that this issue has been brought by a version bump, so we may even restore the previous version instead of hacking.
@cnotv My opinion is that either we fix this properly which, worst case scenario, might implicate the change of all route definitions in Dashboard and extensions OR we pin it to an older version and assume the tech debt for the future.
One thing that would be heartbreaking is for us to deal with this in another version and we would have yet another breaking change for extensions in a different version when it could have been dealt with along with other breaking changes.
We will have for sure more breaking changes in the future, next to the list Vite. This one also does not seem to break yet.
It seems to me that there are several operations to do the refactoring:
router.resolve()
router.replace()
fetchClusterResources(this.$store, METRIC.NODE, { force: true } );
(no idea why log points here)this.showSearchModal = true;
(no idea why log points here)shell/components/nav/Type.vue
shell/components/nav/Group.vue
shell/pages/c/_cluster/explorer/index.vue
shell/components/nav/Header.vue
resource
product
These are the occurrences in the router where are not defined:
I do not see the issue happening for others such as :namespace
or :cluster
.
Log
We could try a quick fix for these 2 parameters, although I rather recommend a single issue with proper investigation. This whole process is way too much for such short notice and for fitting our release planning, so I would rather opt for a version rollback.
I've doubled checked and the warnings do not appear in production builds. That was my biggest concern, as it confuses users and makes support tasks harder.
If there are no functional issues then I'd vote we move this out to 2.11. I don't think there are, @cnotv and @aalves08 can you confirm?
I like my console log to be white and empty π, but agree to be for 2.11 at this point.
There are no functional issue that I am aware of, but we haven't investigated if a proper fix would introduce breaking changes on extensions and that's what I am trying to avoid in the near future since we got them on 2.9 and 2.10 and that raises concerns for me.
We can leave this out for now but if the proper fix introduces breaking changes then I'd say that the milestone needs to be adjusted from 2.11 to another version where we aggregate more breaking changes π
If I got it right, in the current state, you are just not able to retrieve the parameter from the router, but I did not validate the hypothesis. In such case I doubt you need to know what resource or product is or at least not from the router.
@aalves08 a fix shouldn't impact extensions. Routes don't need to change to resolve this, we just need to stop resolving routes with extraneous params as @cnotv pointed out here https://github.com/rancher/dashboard/issues/12128#issuecomment-2401708209.
In fact most of the warnings I saw in both dashboard and harvester are resolved with this experimental change I made (more care needed) https://github.com/rancher/dashboard/pull/12193
As @richard-cox pointed out the warning is wrapped to ensure it doesn't make it into production
I'm going to bump this to 2.11. Feel free to bump it back if you think it needs to be fixed sooner.
Setup
Describe the bug
There's a lot of warnings from vue-router due to the fact that we use custom
params
in our application. According to https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 it's an anti-pattern that is discouraged to use, since we shouldn't defineparams
that aren't defined on the route.One of the biggest problems is that extensions rely on it, despite "hardcoding" it on their routes, so that the routes become unique and don't get a match with our broad wildcarded routes like:
broad dashboard routes
/:product/c/:cluster
vs
elemental example
/elemental/c/:cluster
With that in mind, since our architecture needs the
product
param to work it's magic, in an extension we get a lot of warnings. I believe that dashboard also throws a few warnings as well.To Reproduce
Result Registering/navigating to a route with these "anti-pattern"
params
throws warnings to the consoleExpected Result
No warnings should be thrown to the console
Screenshots
Additional context