cburschka / cadence

A strophe.js-powered XMPP web client for chatrooms.
7 stars 2 forks source link

syncing across versions is weird and broken. #404

Closed cburschka closed 8 years ago

cburschka commented 8 years ago

The symptom here is really weird: If you've got stored settings with a different version than the local client, then you'll get a conflict error every page load, even after you /sync get each time.

Why? Because loading the stored settings will trigger the "version mismatch" case on the next reload (mistake 1; the merge should happen when syncing). Then, config.defaultSettings.sync.time is 0 instead of '', while config.settings.sync.time is an ISO string (mistake 2). The merge algorithm strictly enforces types, so it'll use the default value of 0. That will cause the client to think you last synced in 1970 on the next startup, which causes a conflict error.

Syncing is hard.