Partial `update` on Ember-Data record

For real-time abilities in an app, we have been using pusher to update our records like so:

@get("store").get("adapter").didUpdateRecord(@get("store"), model, record, payload)

Where payload is identical to the json representation to what’s used in an API response.

Now we want to shrink the size of our pusher messages down to just include the attributes that have changed/updated. We have taken care of that on the back-end, except I can’t find anyway for ember to update just the attributes/associations in the payload without nulling out all of the other attributes on the record.

Is this possible?

Not sure if you’ve figured out a solution to your problem, but I stumbled on your question while trying to solve the same problem in my app.

I noticed that the signature for the DS.Store push function takes an optional “_partial” parameter.

  push: function(type, data, _partial) {
    // _partial is an internal param used by `update`.
    // If passed, it means that the data should be
    // merged into the existing data, not replace it.

I was able to update portions of my data set by sending true as the third parameter.

I’m unfamiliar (only been using ember for a couple weeks) with the approach you’re using, but perhaps my scenario will help.

1 Like

@davepreston Thanks for the answer. I updated to a new canary Ember data build and didn’t notice they added this. Exactly what I needed. Also thumbs up for having the same last name as my first name:)