DS.Store#pushPayload
is able to take an array of items, not just one, and may contain side-loaded data. It processes a full payload and expects root keys in the payload:
{
"posts": [{
"id": 1,
"title": "title",
"comments": [1]
}],
"comments": [
//.. and so on ...
]
}
DS.Store#push
expects a single record which has been normalized and contains no side loaded data (notice there is no root key):
{
"id": 1,
"title": "title",
"comments": [1]
}
For this reason, it makes sense for push
to return the record, but for pushPayload
to return nothing.
When you use pushPayload
, a second lookup of store.find('post', 1)
(or store.getById('post', 1)
) is the way to go, I don't believe there is a better way.