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: Modal async #23826

Merged
merged 2 commits into from
May 2, 2020
Merged

fix: Modal async #23826

merged 2 commits into from
May 2, 2020

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 2, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

resolve #23623

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Adjust Modal.xxx function async to avoid block React events.
🇨🇳 Chinese 调整 Modal.xxx 方法为异步以防止其影响 React 事件响应。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

* https://github.com/ant-design/ant-design/issues/23623
* Sync render blocks React event. Let's make this async.
*/
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

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

需要 clear 么?

Copy link
Member Author

Choose a reason for hiding this comment

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

不用,Modal.xxx 没有生命周期。clear 用的是 Modal.destroyAll

Copy link
Member

Choose a reason for hiding this comment

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

这么说 destroyAll 和 destroy 的时候是需要 clear 的,万一两个方法连续调用。

Modal.confirm();
Modal.destroyAll();

@ant-design-bot
Copy link
Contributor

ant-design-bot commented May 2, 2020

@afc163
Copy link
Member

afc163 commented May 2, 2020

/rebase

@zombieJ
Copy link
Member Author

zombieJ commented May 2, 2020

这个组件不用portal重写吗

静态方法是在 React 生命周期外的,没有调用 portal 的时机。

@zombieJ zombieJ merged commit 1489903 into master May 2, 2020
@zombieJ zombieJ deleted the async-modal branch May 2, 2020 16:53
@ycjcl868 ycjcl868 mentioned this pull request May 11, 2020
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.

RangePicker受控模式行为异常
4 participants