-
Notifications
You must be signed in to change notification settings - Fork 605
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
Bug 2003145: Duplicate operand tab titles causes "two children with the same key" warning #10079
Conversation
@kdoberst: This pull request references Bugzilla bug 2003145, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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/test-infra repository. |
a8655d3
to
91b0873
Compare
/retest |
1 similar comment
/retest |
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.
Looks good to me! :)
@@ -190,7 +190,7 @@ export const NavBar = withRouter<NavBarProps>(({ pages, baseURL, basePath }) => | |||
'co-m-horizontal-nav-item--active': matchURL?.isExact, | |||
}); | |||
return ( | |||
<li className={klass} key={nameKey || name}> | |||
<li className={klass} key={nameKey || href}> |
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.
Should we simply always use href
and never name?
On line 186, we have a path || href
check... Is href
always defined?
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.
Href can be an empty string, but that only appears to happen in for the "Details" tab. Href, while in theory, could be undefined, the tab would be non-functional by pointing to a url like: ".../undefined".
On the other hand, path appears to be undefined on a regular basis which might explain why the check was put in on line 186.
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.
We could put in <li className={klass} key={nameKey || href || name}>
to cover all the bases, but I'm not sure it is neccessary.
As a side note, it looks like the exact instance that is referenced in this bug no longer exists (because the names are different), but I still think we should fix this.
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.
I think the empty string is a valid key? In which case key={href}
should work and should be unique.
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.
@spadgett An empty string is a valid key (I double-checked to be sure because I was doubting my memory). I agree, let's just make href the key. Yay simplification.
New changes coming soon.
/hold |
The href is used as the key instead of the name.
91b0873
to
1d25b29
Compare
/unhold |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kdoberst, rebeccaalpert, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@kdoberst: All pull requests linked via external trackers have merged: Bugzilla bug 2003145 has been moved to the MODIFIED state. In response to this:
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/test-infra repository. |
Ensure that each tab on the Operator Details page has a unique key.
How to reproduce the error:
Service Binding
. " error in the browser console.This ensures that tabs that may have the same name will have a unique key.
Note: This will not change the UI