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

[v5] addField on nested fields doesn't work at leaf of first[].second.third[] #1090

Closed
jayphelps opened this issue Jun 2, 2016 · 2 comments · Fixed by #1091
Closed

[v5] addField on nested fields doesn't work at leaf of first[].second.third[] #1090

jayphelps opened this issue Jun 2, 2016 · 2 comments · Fixed by #1091

Comments

@jayphelps
Copy link
Contributor

jayphelps commented Jun 2, 2016

Similar to #630, but with a different property path structure.

first[].second.third[].addField({ forth: "DOESNT WORK" })

While most nested structures work, for whatever reason this particular order of them does not. Just like #630, the fields array in the ADD_ARRAY_VALUE action is empty.

JSBin: http://jsbin.com/wodoxe/edit?js,output

const Form = reduxForm({
  form: 'example-form',
  fields: [
    'first[].second.third[].forth'
  ],
  initialValues: {
    first: [{
      second: {
        third: []
      }
    }]
  }
})(
  ({ fields: { first }, values }) =>
    <div>
      <pre>{JSON.stringify(values)}</pre>
      <button
        onClick={() => first[0].second.third.addField({ forth: 'DOESNT WORK' })}
      >
        Add
      </button>
    </div>
);

No errors.

@jayphelps jayphelps changed the title addField on nested fields doesn't work at leaf of first[].second.third[].forth [v5] addField on nested fields doesn't work at leaf of first[].second.third[].forth Jun 2, 2016
@jayphelps jayphelps changed the title [v5] addField on nested fields doesn't work at leaf of first[].second.third[].forth [v5] addField on nested fields doesn't work at leaf of first[].second.third[] Jun 2, 2016
jayphelps added a commit to jayphelps/redux-form that referenced this issue Jun 2, 2016
erikras added a commit that referenced this issue Jun 3, 2016
fix(readField): Generate correct prefix when reading inside array fields, fixes #1090
@erikras
Copy link
Member

erikras commented Jun 29, 2016

Published in v5.3.0.

@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
None yet
Projects
None yet
2 participants