After reading the docs, this is my understanding of sync
.
I instantiate some Backbone.Model
and call Collection.create()
. create()
eventually calls sync()
and the Model
is POST
ed to the server. Then there is a sync
in the opposite direction such that the Model
on the client is given an id
.
Does this update then trigger componentDidUpdate()
?
Note: componentDidUpdate
is a ReactJS thing, so if that doesn't make sense, the question reduces to "Is the client-side model updated and the view re-rendered?"
Since inside of my componentDidUpdate()
I am making a call to save()
to keep everything up to date, this subsequently makes a call to sync()
which then fires a PUT
request (because the Model
already has an id
).
I'm asking, because in my current application, creating a TodoItem seems to result in a POST
and then a PUT
which I find redundant. Perhaps it is for an unrelated reason.
It actually fires two POSTS and then two PUTS when adding one item, but that is another question.