Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[bug] Quickly expanding several lines with a custom asychronous ExpandIcon onExpand call results in only one line expansion open

未关闭
#961 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
react, typescript
领域
frontend

调研方向

先从 issue 中的 App.jsx 复现开始,或打开链接的 CodeSandbox,然后跟踪涉及自定义 expandIcon 和延迟 onExpand 回调的 Table 展开流程。完成的标准是:在一秒延迟下快速点击多行后,每个被点击的行都保持展开,而不只是最后一行。

由索引模型根据 Issue 内容生成。

描述

Custom ExpandIcon quick expansion

How to reproduce

  1. Open the below code sandbox, or copy the below provided code into a project: CodeSandbox
  2. Open several rows in less than one second

Expected behavior: All the rows that have been clicked open and stay open

Actual behavior: The rows open, but close whenever another open and at the end, only one is open

This only happens when the clicking is done faster than the delay after which onExpand is called

Note:

  • The code sandbox uses the following versions: "antd": "5.2.3", "react": "18.2.0"
  • The problem has also been experienced with Ant Design 4.22.7, and React 17.0.2

App.jsx

I copy the code here in case the codesandbox is inaccessible or lost somehow.

import { Table } from "antd";
import "./styles.css";

export default function App() {
  return (
    <div className="App">
      <h1>Hello Ant Design rc-table</h1>
      <Table
        columns={[{ dataIndex: "key" }]}
        dataSource={[{ key: "bamboo" }, { key: "oak" }, { key: "cinnamon" }]}
        expandable={{
          expandedRowRender: (record) => <span>row-content-{record.key}</span>,
          expandIcon: ({ onExpand, expanded, record }) => {
            return (
              <button
                onClick={() => {
                  setTimeout(() => onExpand(record), 1000);
                }}
              >
                {expanded ? "-" : "+"}
              </button>
            );
          }
        }}
      />
    </div>
  );
}
主要语言
TypeScript
星标
1.4k
派生
619
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

react-component/table 的其他 Issue

查看 react-component/table 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。