Remove deleted files from DB
This commit is contained in:
parent
1b7ab8b038
commit
e7ec41eafe
2 changed files with 8 additions and 1 deletions
|
|
@ -151,6 +151,11 @@ export class Database {
|
||||||
// No need to save as Promises don't get serialized
|
// No need to save as Promises don't get serialized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public removeDocument(find: DocumentRecord): void {
|
||||||
|
this.documents = this.documents.filter((document) => document !== find);
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
|
||||||
public getLatestDocumentByRelativePath(
|
public getLatestDocumentByRelativePath(
|
||||||
find: RelativePath
|
find: RelativePath
|
||||||
): DocumentRecord | undefined {
|
): DocumentRecord | undefined {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,8 @@ export class Syncer {
|
||||||
);
|
);
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
|
|
||||||
|
this.database.removeDocument(document);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -263,7 +265,7 @@ export class Syncer {
|
||||||
const lastSeenUpdateId = this.database.getLastSeenUpdateId();
|
const lastSeenUpdateId = this.database.getLastSeenUpdateId();
|
||||||
if (
|
if (
|
||||||
lastSeenUpdateId === undefined ||
|
lastSeenUpdateId === undefined ||
|
||||||
remote.lastUpdateId > lastSeenUpdateId
|
lastSeenUpdateId < remote.lastUpdateId
|
||||||
) {
|
) {
|
||||||
this.database.setLastSeenUpdateId(remote.lastUpdateId);
|
this.database.setLastSeenUpdateId(remote.lastUpdateId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue