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

把上一份PR(#14) DateTimePicker 的Bug解掉了 #15

Merged
merged 5 commits into from
Jun 26, 2021

Conversation

PotatoEater0127
Copy link

@PotatoEater0127 PotatoEater0127 commented Jun 25, 2021

  • Bug原因:
    DatePicker在選擇日期時會連續觸發 onBlur 與 onChange 事件,進而使得 setFieldTouched 與 setValues 連續觸發,造成使用舊資料進行驗證(race condition),產生驗證不過關的訊息

  • 解法:

  1. 把 setFieldTouched 塞進 setTimeout 執行,使得它比 setValues 晚執行,就會使用 正確/更新 的值做驗證
  2. 把 setFieldTouched 的驗證關掉,驗證就只會在 setValues 後執行,就會使用 正確/更新 的值做驗證

@treelazy treelazy merged commit 67dc405 into treelazy:main Jun 26, 2021
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