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

Test case for issue 19 #20

Merged
merged 1 commit into from
Jul 13, 2019
Merged

Conversation

dekhanov
Copy link
Contributor

Hi, @erikras!

Sorry for directly mentioning you, but I need your help!
I opened issue #19 some time ago, and since there were no activities, I tried to handle it myself.

It turns out that the bug occurs due to moveFieldState function, which expects that objects in the array have the same shape. It's not always true. I wrote a test for this case.

function moveFieldState({ destKey, source }) {
  state.fields[destKey] = {
    ...source,
    name: destKey,
    change: state.fields[destKey].change, // prevent functions from being overwritten
    blur: state.fields[destKey].blur,
    focus: state.fields[destKey].focus,
    lastFieldState: undefined // clearing lastFieldState forces renotification
  }
}

I will be glad to make a fix, but I not sure what to do with these change, blur and focus handlers in case if there is no state.fields[destKey] field.
Could you tell the right way to handle this?

@erikras
Copy link
Member

erikras commented Jul 13, 2019

Great test. Will merge and fix...

@erikras erikras merged commit ced46c6 into final-form:master Jul 13, 2019
@seeden
Copy link

seeden commented Jul 18, 2019

It is not working in 3.0.1

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.

3 participants