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
{{ message }}
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
I haven't yet had a chance to closely inspect the code or do my own testing but was wondering what happens if the client is offline and makes some changes to a model whilst at the same time changes are made to the same model on the server?
When the client comes back online (tested by doing a http ping to the server) and syncDirtyAndDestroyed() is called by an onlineStatusChecker function does the client or the server "win"?
What happens if fetch is called on the model's collection before syncDirtyAndDestroyed() is called?
What happens if syncDirtyAndDestroyed() is called before fetch but the ajax requests haven't yet completed?
The text was updated successfully, but these errors were encountered:
The client probably wins, but you could teach the server to recognize outdated updates, perhaps by checking a timestamp, according to your app's business rules. In more concrete terms, when syncDirtyAndDestroyed syncs successfully, it will send create/update/destroy requests to the server as if they had just been performed.
For fetches, it looks like the entire local store for the collection/model gets cleared out after every successful fetch, which includes dirty and destroyed records. Before the syncDirtyAndDestroyed callback returns (while the ajax requests wait), any fetch on dirty records will return the data in localStorage.
On the topic of synchronicity issues, please be aware of #76 and #35, which has a workaround committed to master (cd17ff2).
The behavior of clearing the store when fetching a model seems like a bug to me. Opened #78 to address this.
I haven't yet had a chance to closely inspect the code or do my own testing but was wondering what happens if the client is offline and makes some changes to a model whilst at the same time changes are made to the same model on the server?
syncDirtyAndDestroyed()
is called by anonlineStatusChecker
function does the client or the server "win"?fetch
is called on the model's collection beforesyncDirtyAndDestroyed()
is called?syncDirtyAndDestroyed()
is called beforefetch
but the ajax requests haven't yet completed?The text was updated successfully, but these errors were encountered: