You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am following the following convention from the docs:
varpost=session.load(App.Post,1);varchildSession=session.newSession();// this creates a "child" sessionvarchildPost=childSession.load(App.Post,1);// this record instance is separate from its corresponding instance in the parent sessionpost===childPost;// returns false, they are separate instancespost.isEqual(childPost);// this will return truechildPost.title='something';// this will not affect `post`childSession.flush();// this will flush changes both to the backend and the parent session, at this point `post` will have its title updated to reflect `childPost`
If the PUT request fails after doing childSession.flush(), post is still updated to match the changes to childPost.
I am using a child session to update a model (it is a user settings page) so it doesn't change in real time in another part of the UI. This is very easy using child sessions and child models (compared to ember-data), but the changes shouldn't merge if the backend PUT fails.
Any workarounds?
The text was updated successfully, but these errors were encountered:
Good find, this should definitely not be the case. I am planning on a big code spike on epf this weekend and will fix this.
For the short term as a workaround, you could "rollback" the parent session's record. This would mean something like the following:
varmodel= ...
varshadow=session.getShadow(model);shadow.copyAttributes(model);// here the model will be in its original state before the child session flushed
I am following the following convention from the docs:
If the PUT request fails after doing childSession.flush(), post is still updated to match the changes to childPost.
I am using a child session to update a model (it is a user settings page) so it doesn't change in real time in another part of the UI. This is very easy using child sessions and child models (compared to ember-data), but the changes shouldn't merge if the backend PUT fails.
Any workarounds?
The text was updated successfully, but these errors were encountered: