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

[v6] Reducer plugin is beeing called for any form #1127

Closed
olegkalyta opened this issue Jun 9, 2016 · 5 comments
Closed

[v6] Reducer plugin is beeing called for any form #1127

olegkalyta opened this issue Jun 9, 2016 · 5 comments
Labels
Milestone

Comments

@olegkalyta
Copy link

olegkalyta commented Jun 9, 2016

I wrote plugin for one form

const formWithPlugin = reduxFormReducer.plugin({
    publicProcessEdit: handleActions({
        'redux-form/CHANGE': (state, { meta: { field }, payload: value }) => {
            // ...
        })
    })
})

But this plugin is also called for any other form

Additionally, it occurs error when i try to update value in plugin:

return update(state, { values: { repeatEvery: { value: { $set: 1 } } } })

because it is called for right form 1 time, and another form in second time for wrong form state is empty and i am getting:

Can't change value of undefined

My temporary solution for it in plugin:

if (Object.getOwnPropertyNames(state).length === 0) {
  return state
}
@ooflorent ooflorent added the bug label Jun 9, 2016
@ooflorent ooflorent added this to the next-6.0.0 milestone Jun 9, 2016
@erikras
Copy link
Member

erikras commented Jun 9, 2016

Ha! 🙈 Testing FAIL on my part. Good catch. Well reported.

@jjduhamel
Copy link

+1

erikras added a commit that referenced this issue Jun 9, 2016
@erikras
Copy link
Member

erikras commented Jun 24, 2016

This is fixed. I will comment here again when the fix is published.

@erikras erikras closed this as completed Jun 24, 2016
@erikras
Copy link
Member

erikras commented Jul 1, 2016

Published in v6.0.0-rc.1.

@lock
Copy link

lock bot commented Jun 2, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants