-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actual react-router-dom upgrade #6504
Conversation
✅ Deploy Preview for kubeapps-dev canceled.
|
6a00ee3
to
92022f6
Compare
Painful day of debugging why updated tests using react-router-dom were now failing with what, after some painful investigation and pinpointing, seemed to be a clarity design system issue where browser-specific calls were being made (ie. that fail in nodejs and cause the test runner to barf). As always, solution was pretty simple (polyfill in tests and jest mock for the other occurrence), so that I can continue easily enough now. Though 135 tests left to update. |
8534e7f
to
38a6bb5
Compare
So all the test code has now been updated for react-router v6 - great, but although the unit tests pass, the actual code fails because connected-react-router never updated to support v6 (and in reality, why should it - it's supporting the old non-hook way of maintaining state). The end result is we need to remove it, which is only 4 containers left using mapStateToProps etc. |
91287df
to
5b3b9e2
Compare
So as well as removing/converting the last containers to proper components, removing the connected-react-router required adding our own custom hook (see |
5b3b9e2
to
1bd24a0
Compare
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
6aae8f6
to
a67208f
Compare
FINALLY!! :P (there's still at least one issue, but I'll fix that separately ... just that when viewing the installed apps, two requests are sent off, one for all namespaces, so the view gets updated with apps from all namespaces after initially rendering). |
@antgamdia It won't be fun, so no problem if you're not keen, but feel free to take a look if you're interested. I'll plan to land it tomorrow with any recommendations :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't get to finish the review in time! Big +1 and thanks for such an effort in refactoring the whole UI "backstage". It's great to finally be able to move to the most recent react-router version!
@@ -165,6 +166,7 @@ function ContextSelector() { | |||
className="clr-page-size-select" | |||
onChange={selectNamespace} | |||
value={namespace} | |||
data-testid="select-namespace" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this field really intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was one that I really struggled to find a way to reference it by role or label in our tests, without a test-id (I didn't want to restructure the markup as part of the change). I just took another look and found I can add an aria-label
attribute to the select
for cluster and namespace, which is better than adding a test-id (since it'll actually function with a correct label text, accessibility-wise). We could also update the span
elements to be label
s but I didn't want to update the markup and, it seems, was being lazy, then I thought you're going to review this too and it's what you'd do, so I've done that instead... good reason for having reviewers. Pushing to a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation and follow-up PR. Happy to be back again!
@@ -261,7 +263,7 @@ export default function OperatorNew() { | |||
</div> | |||
</div> | |||
<div className="clr-form-control"> | |||
<CdsButton type="submit" disabled={disableInstall}> | |||
<CdsButton type="submit" aria-disabled={disableInstall}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? From what I can see in a quick search, it seems both aria-disabled
and disabled
actually disable the input... however, the aria-
one does not prevent the element to be announced in a screen reader. Is this the motivation of the change? If so, perhaps we should extend it to the rest of the inputs, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I'm guessing I was trying to get it to appear in the screen.getByRole()
for a react testing library test. Removing and seeing if tests pass. They do - updated.
@@ -0,0 +1,45 @@ | |||
// Copyright 2018-2023 the Kubeapps contributors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this file is new, it should be just 2023
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, yes, I usually just copy-n-paste an existing header. Seems I fixed this while removing react-router dependencies.
Signed-off-by: Michael Nelson <minelson@vmware.com>
### Description of the change Addresses a couple of small points from the review on #6504 . Turns out it didn't need any extra style - looks identical with the label element (verified in the debugger that it does have the label element etc.): <img width="325" alt="Screenshot 2023-08-07 at 11 21 09 am" src="https://github.com/vmware-tanzu/kubeapps/assets/497518/25fc16b7-168c-4f21-8f79-f6227237503a"> <img width="325" alt="Screenshot 2023-08-07 at 11 22 29 am" src="https://github.com/vmware-tanzu/kubeapps/assets/497518/bcf3dbd1-4033-42bc-a60c-6d44600b4e8f"> ### Benefits Removed unnecessary test-ids and more accessible UX. ### Possible drawbacks <!-- Describe any known limitations with your change --> ### Applicable issues <!-- Enter any applicable Issues here (You can reference an issue using #) --> - ref #6187 ### Additional information <!-- If there's anything else that's important and relevant to your pull request, mention that information here.--> --------- Signed-off-by: Michael Nelson <minelson@vmware.com>
Description of the change
After the prequal work, this PR does the actual upgrade of react-router-dom, including updating all the use of
Route
, as well as removing connected-react-router and the remaining container components. Mostly following from their docs for the upgrade at: https://reactrouter.com/en/main/upgrading/v5#upgrade-to-react-router-v6 with some custom changes required by our specific test infrastructure.Benefits
Finally upgrade react-router and upgrade to hook-based components (something that has been long-running tech-debt slowing us down).
Possible drawbacks
There could be some fall-out of small UX issues that weren't caught in CI. I know of one that I'll fix straight away (two requests sent off for available packages when viewing the catalog - one for all apps in all namespaces).
Applicable issues