TabView: Dynamic Tabs not working #5229
Labels
Type: Bug
Issue contains a defect related to a specific component.
Type: Performance
Issue is performance or optimization related
Milestone
Describe the bug
When using state to track of dynamic tabs, there is bug that arises when you create a tab (let's say with a header "12"), close that tab, and then try to create a new tab with the same name / header. In the code sandbox example I log the state array to the console, and whilst the state array correctly updates and adds the new tab, the TabView does not show the new tab. If you create a new tab with a different name, it gets created.
Reproducer
https://codesandbox.io/s/primereact-demo-forked-ttl6sd?file=/src/App.js:901-1008
PrimeReact version
10.0.9
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
1: Enter a value in the input field and observe how a tab with a header matching your input is created.
2: (Optional) Create a few tabs if you want.
3: Close any one of your tabs.
4: Try to create a new tab with the same input as the tab you just closed.
5: Observe how despite the state updating correctly, the tab is not added back to the TabView UI.
Expected behavior
You should be able to add back tabs that you close.
The text was updated successfully, but these errors were encountered: