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

新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题 #1972

Open
wants to merge 10 commits into
base: release
Choose a base branch
from

Conversation

DaiQiangReal
Copy link
Collaborator

@DaiQiangReal DaiQiangReal commented Dec 11, 2023

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题。
本次 PR 中,只在 Modal 中进行了调用,建议合并后过渡几个大版本没有问题反馈再更新其他组件的 addEventListener 到新的 addEventListener。

Changelog

🇨🇳 Chinese

  • Feat: 新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题

🇺🇸 English

  • Feat: A new addEventListener method is added to address the problem that may occur in the component code due to missed clearing callbacks or failure to timely cause the callback to still be triggered after the component is uninstalled.

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

@DaiQiangReal DaiQiangReal changed the title 新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题 [WIP]新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题 Dec 11, 2023
Copy link

codesandbox-ci bot commented Dec 11, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4096356:

Sandbox Source
Semi Design: Simple Story Configuration

Copy link

cypress bot commented Dec 11, 2023

Passing run #2279 ↗︎

0 223 10 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge 4096356 into d8f24f2...
Project: semi-design Commit: 5ccc0bba16 ℹ️
Status: Passed Duration: 08:38 💡
Started: Feb 7, 2024 10:29 AM Ended: Feb 7, 2024 10:38 AM

Review all test suite changes for PR #1972 ↗︎

@DaiQiangReal DaiQiangReal changed the title [WIP]新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题 新增 addEventListener 方式兜底组件代码可能出现的遗漏清除回调或不及时导致组件卸载后回调仍然触发的问题 Dec 11, 2023
@@ -109,6 +109,7 @@ class ArrayFieldComponent extends Component<ArrayFieldProps, ArrayFieldState> {
const updater = this.context;
const { field } = this.props;
updater.unRegisterArrayField(field);
super.componentWillUnmount();
Copy link
Collaborator

Choose a reason for hiding this comment

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

非继承自 BaseComponent,实际上调的是 react 原生 component 的 willUnMount

Copy link
Collaborator

Choose a reason for hiding this comment

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

可以去掉。

@pointhalo
Copy link
Collaborator

image

@codecov-commenter
Copy link

Codecov Report

Attention: 39 lines in your changes are missing coverage. Please review.

Comparison is base (e558b07) 87.29% compared to head (5ccc0bb) 87.25%.
Report is 46 commits behind head on release.

❗ Current head 5ccc0bb differs from pull request most recent head 4096356. Consider uploading reports for the commit 4096356 to get more accurate results

Files Patch % Lines
packages/semi-foundation/cascader/util.ts 55.00% 9 Missing ⚠️
packages/semi-ui/_base/baseComponent.tsx 80.55% 7 Missing ⚠️
packages/semi-ui/_utils/index.tsx 74.07% 7 Missing ⚠️
packages/semi-foundation/cascader/foundation.ts 81.25% 3 Missing ⚠️
packages/semi-foundation/tooltip/foundation.ts 57.14% 3 Missing ⚠️
packages/semi-ui/cascader/index.tsx 82.35% 3 Missing ⚠️
...es/semi-foundation/image/previewInnerFoundation.ts 50.00% 1 Missing ⚠️
...ackages/semi-foundation/overflowList/foundation.ts 50.00% 1 Missing ⚠️
packages/semi-foundation/select/foundation.ts 0.00% 1 Missing ⚠️
...ges/semi-foundation/utils/getMotionObjFromProps.ts 0.00% 1 Missing ⚠️
... and 3 more

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           release    #1972      +/-   ##
===========================================
- Coverage    87.29%   87.25%   -0.04%     
===========================================
  Files          438      439       +1     
  Lines        25761    25807      +46     
  Branches      6556     6573      +17     
===========================================
+ Hits         22489    22519      +30     
- Misses        3272     3288      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

None yet

3 participants