1

This is the model that is expecting the lessons:

export const LessonModel = types.model({
    is_imported: types.boolean,
})

const CalendarStoreModel = types.model('newCalendarStore',{
    lessons: types.optional(types.array(LessonModel),[]),
     selectedDate: types.string
})

and here I am providing the lessons

const model = {
    lessons: [  
       {
        is_imported: false,
       }
    ],
    selectedDate: "2020-10-21"
}

Tried wrapping the lessons on LessonModel.create but it did not fix it.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
meowzart
  • 75
  • 1
  • 8
  • 1
    [Your example seems to work nicely](https://codesandbox.io/s/infallible-lake-1dd0l?file=/src/index.js). Are you sure this is the data you are using to create the model with in your code? – Tholle Nov 23 '20 at 18:36
  • The data being entered was correct but I am using types.compose to create the store. if I need it in the sandbox with the array I get the same error but if I do it without an array no error. – meowzart Nov 25 '20 at 11:29
  • const NewCalendarStore = types.compose( 'newCalendarStore', ApiStore, types.model('NewCalendar', model).actions(actions).views(views) ) – meowzart Nov 25 '20 at 11:41
  • Was creating the store like this and if you refactor the sandbox example to use this instead you will get the same error. – meowzart Nov 25 '20 at 11:42

0 Answers0