You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Bugfix where, upon refresh, it was impossible to write to the db (clone errors)
This commit is contained in:
@@ -513,11 +513,14 @@ SyncApi.prototype._sync = function(syncOptions) {
|
|||||||
|
|
||||||
let isCachedResponse = false;
|
let isCachedResponse = false;
|
||||||
if (self.opts.syncAccumulator && !syncOptions.hasSyncedBefore) {
|
if (self.opts.syncAccumulator && !syncOptions.hasSyncedBefore) {
|
||||||
const data = self.opts.syncAccumulator.getJSON();
|
let data = self.opts.syncAccumulator.getJSON();
|
||||||
// Don't do an HTTP hit to /sync. Instead, load up the persisted /sync data,
|
// Don't do an HTTP hit to /sync. Instead, load up the persisted /sync data,
|
||||||
// if there is data there.
|
// if there is data there.
|
||||||
if (data.nextBatch) {
|
if (data.nextBatch) {
|
||||||
debuglog("sync(): not doing HTTP hit, instead returning stored /sync data");
|
debuglog("sync(): not doing HTTP hit, instead returning stored /sync data");
|
||||||
|
// We must deep copy the stored data so that the /sync processing code doesn't
|
||||||
|
// corrupt the internal state of the sync accumulator (it adds non-clonable keys)
|
||||||
|
data = JSON.parse(JSON.stringify(data));
|
||||||
this._currentSyncRequest = q.resolve({
|
this._currentSyncRequest = q.resolve({
|
||||||
next_batch: data.nextBatch,
|
next_batch: data.nextBatch,
|
||||||
rooms: data.roomsData,
|
rooms: data.roomsData,
|
||||||
|
Reference in New Issue
Block a user