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

fix(array-table): body wrapper was recreated in every table re-render #44

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

hmilin
Copy link
Contributor

@hmilin hmilin commented Jul 30, 2024

Before submitting a pull request, please make sure the following is done...

  • Ensure the pull request title and commit message follow the Commit Specific in English.
  • Fork the repo and create your branch from master or master.
  • If you've added code that should be tested, add tests!
  • If you've changed APIs, update the documentation.
  • Ensure the test suite passes (npm test).
  • Make sure your code lints (npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.

Please do not delete the above content


What have you changed?

当前Table组件的components.body.wrapper参数在每次重新渲染时都返回新的函数组件,导致每次arrayField变化(如push一条数据)时,tbody以下的组件都重新创建并挂载而非update

修改前

<Table
    components={{
      body: {
        wrapper: genWrapperComp(dataSource, startIndex),
        row: RowComp,
      },
    }}
  />

修改后

<Table
    components={{
      body: {
        wrapper: WrapperComp,
        row: RowComp,
      },
    }}
  />

Copy link

netlify bot commented Jul 30, 2024

Deploy Preview for formily-antd5 ready!

Name Link
🔨 Latest commit bb80d3f
🔍 Latest deploy log https://app.netlify.com/sites/formily-antd5/deploys/66a84d8631a20b0008454224
😎 Deploy Preview https://deploy-preview-44--formily-antd5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yiyunwan yiyunwan merged commit 0df4364 into formilyjs:master Aug 12, 2024
7 checks passed
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.

2 participants