Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: stabilize useField public handler identity #931

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

Merged
erikras merged 1 commit into final-form:main from kapral18:fix/stabilize-usefield-public-handler-identities
Jul 22, 2021
Merged

fix: stabilize useField public handler identity #931

erikras merged 1 commit into final-form:main from kapral18:fix/stabilize-usefield-public-handler-identities
Jul 22, 2021

Conversation

@kapral18
Copy link
Contributor

@kapral18 kapral18 commented Jul 21, 2021
edited
Loading

useField public handlers like onFocus, onChange, onBlur are changing their identities based on various internal variables and externally available props/(config parts) like value, name, parse etc...

I am suggesting that public handlers should not be subject to identity change at all, so that consumers can rely on those without jumping through hoops with useRef as in https://reactjs.org/docs/hooks-faq.html#what-can-i-do-if-my-effect-dependencies-change-too-often.

As a consequence after this change consumer code relying on this behavior might break, hence this is a BREAKING CHANGE

Closes #816

Copy link

codesandbox-ci bot commented Jul 21, 2021
edited
Loading

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 057c7a2:

Sandbox Source
🏁 React Final Form - Third Party Components Example Issue #816

BREAKING:
onBlur, onChange, onFocus handlers no longer change identity
if props or internal state is changed,
thus on consumer side the behavior relying on handler identity can break
Closes #816 
Copy link
Member

erikras commented Sep 29, 2021

Published in v6.5.4.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

input.onChange has a new reference each time value changes

2 participants

AltStyle によって変換されたページ (->オリジナル) /