Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

actions.remove issue in v1.1.0+ #553

Closed
msteward opened this issue Dec 2, 2016 · 1 comment
Closed

actions.remove issue in v1.1.0+ #553

msteward opened this issue Dec 2, 2016 · 1 comment

Comments

@msteward
Copy link
Contributor

msteward commented Dec 2, 2016

React Redux Form version: 1.3.0
Lodash Version: 4.17.2

Steps to reproduce:

  1. Create repeating form element and add a few instances (see screenshot below for sample form state structure following this) using actions.push('modelName', initialModelState)

screen shot 2016-12-02 at 08 56 41

  1. Remove one of the items using actions.remove('modelName', index) (http://davidkpiano.github.io/react-redux-form/docs/api/actions.html#actions-remove)
  2. Try to remove a second item in the array using the same actions.remove method.

Expected Result:

The items are removed as expected.

Actual Result:

The first item is removed without issue. Subsequent attempts to remove items result in the following error:
screen shot 2016-12-02 at 09 00 43

Further Info

This breakage for me was introduced in v1.1.0. v1.0.15 does not exhibit this error.
The problems appears to be introduced in line 37-66 of src/reducers/form/change-action-reducer.js

On the first remove that works the value of field on line 38 is an object with the $form attribute:
screen shot 2016-12-02 at 09 07 18

On the second the remove the value is a basic array:
screen shot 2016-12-02 at 09 08 21

Nothing else had been done to the form state in between the 2 removes and there are no custom reducers involved.

@davidkpiano
Copy link
Owner

Really excellent issue description, thanks so much! Looking into this now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants