|
|
@ -6,7 +6,7 @@ import * as Etebase from "etebase";
|
|
|
|
import { store, StoreState } from "../store";
|
|
|
|
import { store, StoreState } from "../store";
|
|
|
|
|
|
|
|
|
|
|
|
import { credentialsSelector } from "../credentials";
|
|
|
|
import { credentialsSelector } from "../credentials";
|
|
|
|
import { setSyncCollection, setSyncGeneral, setCacheItem, setCacheCollection, unsetCacheCollection, unsetCacheItem } from "../store/actions";
|
|
|
|
import { setSyncCollection, setSyncGeneral, setCacheCollection, unsetCacheCollection, setCacheItemMulti } from "../store/actions";
|
|
|
|
|
|
|
|
|
|
|
|
const cachedSyncManager = new Map<string, SyncManager>();
|
|
|
|
const cachedSyncManager = new Map<string, SyncManager>();
|
|
|
|
export class SyncManager {
|
|
|
|
export class SyncManager {
|
|
|
@ -44,13 +44,7 @@ export class SyncManager {
|
|
|
|
let done = false;
|
|
|
|
let done = false;
|
|
|
|
while (!done) {
|
|
|
|
while (!done) {
|
|
|
|
const items = await itemMgr.list({ stoken, limit });
|
|
|
|
const items = await itemMgr.list({ stoken, limit });
|
|
|
|
for (const item of items.data) {
|
|
|
|
store.dispatch(setCacheItemMulti(col.uid, itemMgr, items.data));
|
|
|
|
if (item.isDeleted) {
|
|
|
|
|
|
|
|
store.dispatch(unsetCacheItem(col.uid, itemMgr, item.uid));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
store.dispatch(setCacheItem(col, itemMgr, item));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
done = items.done;
|
|
|
|
done = items.done;
|
|
|
|
stoken = items.stoken;
|
|
|
|
stoken = items.stoken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|