Meteor-Community-Packages / meteor-autoform

AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
MIT License
1.44k stars 328 forks source link

quickform error after migrating to simpl-schema npm #1689

Closed jowilhnson closed 5 years ago

jowilhnson commented 5 years ago

Working on updating a 3 year old application to Meteor 1.8 and updated simpl-schema and went through changelog and made necessary changes, mostly with few problems. Having difficulty sorting out this error that comes up on a couple of quickform instances.

Exception in template helper: Error: The type for "scores" is set to a SimpleSchema instance that defines "scores.CFC", but the parent SimpleSchema instance also tries to define "scores.CFC"

For the quickform: {{> quickForm id="updatePlaPrint" type="update-pushArray" collection="Students" schema=whichSchema doc=selectedStudent scope="tests" buttonContent="Save Scores"}}

I'm not sure what schema it is referring to as the "parent SimpleSchema instance", whether it means the schema chosen by "whichSchema" helper, the schema of the Students collection and the doc being referenced, or something else.

It is possible that I made a mistake combining schemas together and changing things to the new 'extend' syntax, however the schemas seem to be working the same as they did before for collections and all other instances of autoforms and quickforms, and only seem to be having issues on these particular update-pushArray forms.

export const PlaStudentsSchema = new SimpleSchema({
    tests: {
        type: Array,
        defaultValue: []
    },

    'tests.$': {
        type: Object,
        optional: true
    },

    'tests.$.scores':{
        type:PlaScoresSchema,
        defaultValue: {'$':-1}
    }
});
PlaStudentsSchema.extend(StudentsBaseSchema);

Any tips would be appreciated.

Seriously, any feedback whatsoever to point me in the right direction would be greatly appreciated. More than happy to keep working on this myself, but could use some info as to what might the error message is referring to as the 'Parent Schema' to sort out what it is seeing as a conflict.

I had to update a ton of code mostly because of the changes to simpl-schema and related packages. I don't mind, getting up to date is good, but many hours of work are being held back by this one error at this point.