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: disable modal button before press handler promise becomes to resolve state #1252

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cw1997
Copy link

@cw1997 cw1997 commented Aug 19, 2022

First of all, thank you for your contribution! :-)

主要修复:当Model.alert的OK按钮的onPress为一个async function时,点击按钮后需要暂时将该按钮禁用,直到onPress函数的Promise被resolve后才能将OK按钮恢复为启用状态。另外,buttonStyle的生成逻辑也有问题,在这个PR顺带做了修复。
最后,我本地执行test:all和lint都出错,请问你们之前有遇到类似情况吗?是如何处理的呢?
image
image

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

  • Make sure that you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Extra checklist:

if isBugFix :

  • Make sure that you add at least one unit test for the bug which you had fixed.

elif isNewFeature :

  • Update API docs for the component.
  • Update/Add demo to demonstrate new feature.
  • Update TypeScript definition for the component.
  • Add unit tests for the feature.

}
button.style = 'disabled'
await originPress()
Copy link
Collaborator

@1uokun 1uokun Aug 23, 2022

Choose a reason for hiding this comment

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

逻辑漏洞:originPress()内执行reject将永远不可被点击

虽然可以让下面的代码不继续下去,
但是也会导致下一次点击时style值仍为'disabled'

Copy link
Author

Choose a reason for hiding this comment

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

了解,我再修正一下

@1uokun

This comment was marked as outdated.

@1uokun
Copy link
Collaborator

1uokun commented Aug 23, 2022

最后,我本地执行test:all和lint都出错,请问你们之前有遇到类似情况吗?是如何处理的呢?

fixed: 1a9c367

@cw1997
Copy link
Author

cw1997 commented Aug 23, 2022

最后,我本地执行test:all和lint都出错,请问你们之前有遇到类似情况吗?是如何处理的呢?

fixed: 1a9c367

收到!我rebase后再去测试一下

@cw1997
Copy link
Author

cw1997 commented Aug 27, 2022

@1uokun 我在本地yarn start时发现DEMO无法运行,我尝试将错误信息中提到的babel相关依赖手动在左侧package.json中安装后仍然无法解决,请问你知道这是哪里的BUG吗?

image

@cw1997 cw1997 force-pushed the fix/disable-modal-button-before-press-handler-promise-becomes-to-resolve-state branch from 60b5261 to a431014 Compare August 27, 2022 05:16
@1uokun
Copy link
Collaborator

1uokun commented Aug 28, 2022

yarn start 命令跑的是 网页使用文档 项目,可以去分支feat-snack-expo查看最新的

或者可以去 /example 目录下调试组件全览demo

@1uokun
Copy link
Collaborator

1uokun commented Aug 31, 2022

done了吗bro @cw1997

@cw1997
Copy link
Author

cw1997 commented Aug 31, 2022

done了吗bro @cw1997

不好意思,最近公司这边也比较忙,这个我下周有空再来看看

目前example已经能够正常跑起来了,但是确认按钮切换显示loading状态的逻辑还是有点问题,这个我下周再来处理

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

2 participants