#ember-data update model breaks page after save

1 messages · Page 1 of 1 (latest)

tulip tiger
#

I'm properly saving my data using

await this.model.save();

but after saving and it gets back the data it' doesn't run my setupController function that does this code to make sure the data can be edited in the admin. So the page breaks because the arrays aren't ember Arrays. Do I have turn this function into a helper function run this code below manually after every save ?

  setupController(controller, model){

model.permissions = A(model.permissions.map(e => {
          return new TrackedObject(e);
      }))
      model.users = A(model.users.map(e => {
          return new TrackedObject(e);
      }))

}
     ```
#

@velvet tusk would you be able to tell me if this is how it's normally done?

#

LOL ... I figured it out.. I created a function on the model.

#

and just called that when I'm in admin mode.. if not just leave it alone

velvet tusk
#

This seems really weird

#

doesn’t look like you’re using WarpDrive/EmberData at all if not for the save call

tulip tiger
#

Oh I fixed this issue