jeudi 7 avril 2016

Ember data route model hook creating new record every transition

this code:

model(){
    return this.store.findRecord("user", this.get("session.data.authenticated.user_id"))
      .then(user => this.store.createRecord("info", {user}));
  },

creates a new record every time the route changes, meaning the data is lost on route switch, and the ember inspector shows a bunch of empty records.

I tried using fetchRecord instead of createRecord, but the entire app breaks.

.then(user => this.store.fetchRecord("info", {user}))

does anyone know how to prevent this?




Aucun commentaire:

Enregistrer un commentaire