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(Form): fix Field onChange reset value #2197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MarvelSQ
Copy link
Member

fix #2192

@vercel
Copy link

vercel bot commented Dec 10, 2021

@MarvelSQ is attempting to deploy a commit to the rsuite Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Dec 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

rsuite-nextjs – ./docs

🔍 Inspect: https://vercel.com/rsuite/rsuite-nextjs/44k5PrTWXG8ZPA6Drt89QsddVAsY
✅ Preview: https://rsuite-nextjs-git-fork-marvelsq-fix-formcontrol-deps-rsuite.vercel.app

@codesandbox-ci
Copy link

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 a2d2bd6:

Sandbox Source
rsuite-tp-ci Configuration
magical-bardeen-fi6yz Issue #2192

@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #2197 (a2d2bd6) into main (c31f080) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2197      +/-   ##
==========================================
+ Coverage   85.21%   85.24%   +0.03%     
==========================================
  Files         269      269              
  Lines        8493     8497       +4     
  Branches     2356     2356              
==========================================
+ Hits         7237     7243       +6     
  Misses        685      685              
+ Partials      571      569       -2     
Flag Coverage Δ
ChromeCi 85.19% <100.00%> (+<0.01%) ⬆️
Firefox 85.23% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Form/Form.tsx 87.06% <100.00%> (+0.46%) ⬆️
src/Modal/utils.ts 94.28% <0.00%> (+5.71%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c31f080...a2d2bd6. Read the comment docs.


const _formValueRef = useRef(_formValue);

_formValueRef.current = _formValue;
Copy link
Member

Choose a reason for hiding this comment

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

这解决方案,很奇怪,并且可读性不太好,我更推荐使用 useReducer

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.

FormControl onChange 存在闭包
2 participants