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

Explicit ListField inside ListField #91

Closed
mixcas opened this issue Aug 9, 2016 · 2 comments
Closed

Explicit ListField inside ListField #91

mixcas opened this issue Aug 9, 2016 · 2 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@mixcas
Copy link

mixcas commented Aug 9, 2016

I'm using uniforms@1.0.0-rc.29 and uniforms-unstyled@1.0.0-rc.29
This is my schema:

export const ArtistsSchema = new SimpleSchema({
  // Artists
  artists: {
    type: [ Object ],
    minCount: 1,
  },
  'artists.$.name': {
    type: String,
  },
  'artists.$.work': {
    type: [ Object ],
    minCount: 1,
    maxCount: 5,
  },
  'artists.$.work.$.workTitle': {
    type: String,
  },
  'artists.$.work.$.medium': {
    type: String,
  },
  'artists.$.work.$.dimensions': {
    type: String,
  },
  'artists.$.work.$.year': {
    type: String,
  },
});

And my form:

 <AutoForm
  autosave
  schema={ArtistsSchema}
  onSubmit={this.onSubmit.bind(this)}
  onValidate={this.onValidate.bind(this)}
  model={this.props.model}
>
  <ListField name="artists">
    <ListItemField name="$">
      <NestField>
        <AutoField name="name" />
        <ListField name="work">
          <ListItemField name="$">
            <NestField>
              <AutoField name="workTitle" />
              <AutoField name="medium" />
              <AutoField name="dimensions" />
              <AutoField name="year" />
            </NestField>
          </ListItemField>
        </ListField>

      </NestField>
    </ListItemField>
  </ListField>
  <ErrorsField />
</AutoForm>

I'm getting this error: Invariant Violation: Field not found in schema: "artists.0.work.artists.0.0"

Using <AutoField name="work" /> works fine tho.

@mixcas mixcas changed the title Excplicit ListField inside ListField Explicit ListField inside ListField Aug 9, 2016
@radekmie radekmie added the Type: Bug Bug reports and their fixes label Aug 9, 2016
@radekmie radekmie self-assigned this Aug 9, 2016
@radekmie
Copy link
Contributor

radekmie commented Aug 9, 2016

I've looked into the component tree rendered by AutoField that renders ListField and it seems to be the same. I'll try to fix it later today.

@radekmie
Copy link
Contributor

radekmie commented Aug 9, 2016

There was a problem with nesting NestField - now everything works fine. I'll also release next version (1.0.0-rc.30) later.

@radekmie radekmie moved this to Closed in Open Source Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

2 participants