Skip to content

Commit b8f7c98

Browse files
committed
Offline.clearLastSync, bump revision
1 parent 3d85453 commit b8f7c98

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onehat/data",
3-
"version": "1.15.5",
3+
"version": "1.15.6",
44
"description": "JS data modeling package with adapters for many storage mediums.",
55
"main": "src/index.js",
66
"type": "module",

src/Integration/ReactNative/Repository/AsyncStorage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ class AsyncStorageRepository extends OfflineRepository {
207207
}
208208

209209
clearAll = async () => {
210-
return await this.load([]);
210+
await this.load([]);
211+
await this.clearLastSync();
211212
}
212213

213214
getAllKeys = async () => {

src/Repository/Offline.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,15 @@ class OfflineRepository extends MemoryRepository {
407407
await this._storageSetValue(LAST_SYNC, date);
408408
}
409409

410+
411+
/**
412+
* Clears the date when this Repository was last synced with remote.
413+
* Used when this is the "local" side of a LocalFromRemoteRepository
414+
*/
415+
clearLastSync = async () => {
416+
await this._storageDeleteValue(LAST_SYNC);
417+
}
418+
410419
};
411420

412421
OfflineRepository.className = 'Offline';

0 commit comments

Comments
 (0)