Skip to content
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
Copy link
Contributor

Ensure that each tab on the Operator Details page has a unique key.

How to reproduce the error:

  1. Install the Service Binding operator
  2. Go to the Service Binding details page
  3. Look for the "Warning: Encountered two children with the same key, 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

@openshift-ci openshift-ci bot added the bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. label Sep 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 15, 2021

@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
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @yapei

In response to this:

Bug 2003145: Duplicate operand tab titles causes "two children with the same key" warning

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.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Sep 15, 2021
@openshift-ci openshift-ci bot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 15, 2021
@kdoberst kdoberst force-pushed the Bug-2003145-Duplicate-operand-tab-titles-causes-two-children-with-the-same-key-warning branch from a8655d3 to 91b0873 Compare September 15, 2021 19:20
@kdoberst
Copy link
Contributor Author

/retest

1 similar comment
@kdoberst
Copy link
Contributor Author

kdoberst commented Oct 4, 2021

/retest

Copy link
Contributor

@rebeccaalpert rebeccaalpert left a 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}>
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@kdoberst
Copy link
Contributor Author

kdoberst commented Oct 4, 2021

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 2021
The href is used as the key instead of the name.
@kdoberst kdoberst force-pushed the Bug-2003145-Duplicate-operand-tab-titles-causes-two-children-with-the-same-key-warning branch from 91b0873 to 1d25b29 Compare October 4, 2021 20:31
@kdoberst
Copy link
Contributor Author

kdoberst commented Oct 4, 2021

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 2021
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 5, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 45bd5f9 into openshift:master Oct 5, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 5, 2021

@kdoberst: All pull requests linked via external trackers have merged:

Bugzilla bug 2003145 has been moved to the MODIFIED state.

In response to this:

Bug 2003145: Duplicate operand tab titles causes "two children with the same key" warning

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.

@spadgett spadgett added this to the v4.10 milestone Oct 7, 2021
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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants