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

feat(space): add current key for Item #1414

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

VladislavNsk
Copy link
Contributor

Опишите проблему

При использовании компонента Space, если удалить дочерний элемент, то все остальные элементы размонитруются и смонтируются заново, при условии что key никак не меняется при этом

Шаги для воспроизведения

Добавить в Space несколько элементов и после удалить первый

<Space>
  {rows.map(({text, id}) => (
      <Component key={id}>
        {text}
      </Component>        
  ))}
</Space>
<button>
 Удалить первую строку
</button>

Пример можно посмотреть тут
https://codesandbox.io/s/infallible-water-27jjg5?file=/src/index.js

Ожидаемое поведение

Удалится первый элемент, остальные никак не среагируют на это

Чек лист

  • Тесты
  • Документация

Опишите проблему

При использовании компонента Space, если удалить дочерний элемент, то все остальные элементы размонитруются и смонтируются заново, при условии что key никак не меняется при этом

Шаги для воспроизведения

Добавить в Space несколько элементов и после удалить первый

<Space>
  {rows.map(({text, id}) => (
      <Component key={id}>
        {text}
      </Component>        
  ))}
</Space>
<button>
 Удалить первую строку
</button>

Пример можно посмотреть тут
https://codesandbox.io/s/infallible-water-27jjg5?file=/src/index.js

Ожидаемое поведение

Удалится первый элемент, остальные никак не среагируют на это

Чек лист

  • Тесты
  • Документация

Copy link

changeset-bot bot commented Oct 14, 2024

🦋 Changeset detected

Latest commit: bc5a4d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alfalab/core-components-space Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

'@alfalab/core-components-space': patch
---

Для дочернего компонента-оберки Space -> Item прокидываем key который передали или сгенерировал react
Copy link
Collaborator

Choose a reason for hiding this comment

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

оберки -> опечатка

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Исправил

@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

@core-ds-bot
Copy link
Collaborator

Собрана новая демка.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants