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

[Feature Request] Get last dirty state of unregistered field (when destroyOnUnregister is false) #447

Open
jedwards1211 opened this issue Feb 23, 2022 · 2 comments

Comments

@jedwards1211
Copy link
Contributor

Are you submitting a bug report or a feature request?

Feature request

What is the current behavior?

If I register a field foo, it becomes dirty, and then I unregister it, I can't get the last dirty state. form.getFieldState('foo') returns null.

What is the expected behavior?

I didn't set destroyOnUnregister and the default value is false so I kind of expected the field state to be preserved since the field value is. It would be nice to at least have an option to preserve the last field state, since I'll have to hack together some way to do it manually.

What's your environment?

Final Form 4.20.4

Other information

I'm using Final Form for cell values in an infinite scrolling table, and I want to only submit rows that were changed, so I need to be able to know what unmounted rows were changed.

@gertdreyer
Copy link
Collaborator

Related to #474

@gertdreyer
Copy link
Collaborator

I suspect all meta values become undefined when an input field no longer exists thus the context is lost. destroyOnUnregister only refers to the field value if you read the docs. Therefore the actual value for the field in the values object is destroyed.

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

No branches or pull requests

2 participants