Skip to content

TabContent renders incorrect Content #7097

@abhinandan13jan

Description

@abhinandan13jan

Describe the issue. What is the expected and unexpected behavior?
TabContents is rendered using index as Key, instead of the Tab's {eventKey} prop. This causes Content mismatch for a Tab.

Example.

We have 3 tabs ->  
Tab 1 -> Title : "Terminal 21", TabContent: "oc get pods"
Tab 2 -> Tiltle: "Terminal 24", TabContent: "This content should have been removed"
Tab 3 -> Title: "Terminal 26", TabContent: "correct content"

Now, If we remove "Tab 2", we get 
Tab 1 -> Title : "Terminal 21", TabContent: "oc get pods"
Tab 2 -> Title: "Terminal 26", TabContent: "This content should have been removed" 

instead of 

Tab 1 -> Title : "Terminal 21", TabContent: "oc get pods"
Tab 2 -> Title: "Terminal 26", TabContent: "correct content"

This occurs as 
 <TabContent
              key={index}

 instead of something like             
  <TabContent
              key={child.props.eventKey}          

Please provide the steps to reproduce. Feel free to link CodeSandbox or another tool.

  1. Create a Tab using custom eventKey which are not in order/sync with the index.
  2. Dynamically remove a tab from middle of the array of Tab
  3. The TabContent is not removed and is simply passed to the next Tab's TabContent

pf-tab-content-issue

Is this a bug or enhancement? If this issue is a bug, is this issue blocking you or is there a work-around?
Blocking. Bug

What is your product and what release version are you targeting?
Openshift Console 4.11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions