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 chaining the saving of a few resources. When the first resource is saved, it is updated with the ID that I need to save the second resource (via a binding). However, when I use jQuery.Deferred callbacks to trigger the chain, the bindings from the first objects don't propagate to the second object.
I'm wondering whether it makes sense to call SC.run.sync() before calling toJSON() in the save() function. I'm not sure whether it's the best solution to do it synchronously because the save() call might be tied to a user action.
Here's some demo code that manifests the issue:
R=SC.Resource.define({url: '/url',schema: {id: String,foo: String}});Demo=SC.Application.create({foo: 'hello',r: R.create({fooBinding: 'Demo.foo'})});// run.once() to allow the original value to syncSC.run.once(Demo,function(){Demo.set('foo','world');Demo.r.save();});
In this test, foo=hello is sent to the server, not foo=world
The text was updated successfully, but these errors were encountered:
I am chaining the saving of a few resources. When the first resource is saved, it is updated with the ID that I need to save the second resource (via a binding). However, when I use jQuery.Deferred callbacks to trigger the chain, the bindings from the first objects don't propagate to the second object.
I'm wondering whether it makes sense to call SC.run.sync() before calling toJSON() in the save() function. I'm not sure whether it's the best solution to do it synchronously because the save() call might be tied to a user action.
Here's some demo code that manifests the issue:
In this test, foo=hello is sent to the server, not foo=world
The text was updated successfully, but these errors were encountered: