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

Tab position not updating when component is removed from render #4967

Closed
brandonmp opened this issue Aug 12, 2016 · 1 comment
Closed

Tab position not updating when component is removed from render #4967

brandonmp opened this issue Aug 12, 2016 · 1 comment
Labels
component: tabs This is the name of the generic UI component, not the React module! v0.x

Comments

@brandonmp
Copy link

Problem description

This happens when rendering an array of <Card>s with nested <Tab>s.

Let's say I have an array of 10 cards, each w/ tabs, which I render via a .map() call. I also have filter toggles that add/remove cards.

If I click on the second tab of the first card, then toggle a filter that makes that card disappear, the new first card shows up with tab 2 active.

The data for the card is correct--title, picture, etc., but the tab position is leftover from the previous #1 card.

This is the case both with and without controlled tabs.

Steps to reproduce

create a series of cards (with nested <Tabs>) via .map()

create a state-driven filter

Pick a non-default tab on the first card

Apply filter that removes 1st card

New first card should be stuck on the tab you picked before filtering

Versions

  • Material-UI: 0.15.3
  • React: 15.2.0
  • Browser: Chrome, firefox, latest versions
@brandonmp
Copy link
Author

Turns out I was using index for a key, which isn't a value that's unique to the item in the array, so sort etc. got things all mixed up.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: tabs This is the name of the generic UI component, not the React module! v0.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! v0.x
Projects
None yet
Development

No branches or pull requests

3 participants