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

Tag的Group在重绘时无法删除老的数据 #135

Open
HengzheLi opened this issue Dec 15, 2021 · 1 comment
Open

Tag的Group在重绘时无法删除老的数据 #135

HengzheLi opened this issue Dec 15, 2021 · 1 comment

Comments

@HengzheLi
Copy link

HengzheLi commented Dec 15, 2021

selectedAccounts是个数组,在selectedAccounts改变时Group会重新绘制,但是在重绘时,上一次列表中的数据还保留在界面。期望是在Group重绘时,只显示这一次selectedAccounts中的数据。
是我的用法不对吗?

  const [selectedAccounts, setSelectedAccounts] = React.useState<DataSource[]>(dataSource);
  const onSelectedAccountClose = (record: DataSource) => {
    const filteredArray = selectedAccounts.filter((a) => a.contentItemId != record.contentItemId);
    setSelectedAccounts(filteredArray);
    return true;
  };

<Group>
            {selectedAccounts.map((a) => (
              <Closeable key={a.login} onClose={() => onSelectedAccountClose(a)}>
                {`${a.login}`}
              </Closeable>
            ))}
</Group>
@HengzheLi
Copy link
Author

貌似是到一定数量之后才会出现这个现象,我现在的是55个Closeable 元素

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

No branches or pull requests

1 participant