Sending change signal on delete

This commit is contained in:
Fabian Stamm 2019-10-30 16:06:28 +01:00
parent 15df0351a4
commit a78e98a0c8
2 changed files with 36 additions and 37 deletions

View File

@ -139,12 +139,12 @@ export default class Query {
} }
async set(value: any) { async set(value: any) {
if (value === null || value === undefined)
return this.delete(value);
const lock = await this.database.locks.lock(this.path); const lock = await this.database.locks.lock(this.path);
let batch = this.database.level.batch(); let batch = this.database.level.batch();
try { try {
if (value === null || value === undefined) {
this.delete(value);
} else {
let field = await this.getField(this.path); let field = await this.getField(this.path);
if (field) { if (field) {
await this.delete(batch); await this.delete(batch);
@ -181,6 +181,7 @@ export default class Query {
} }
saveValue(this.path, value); saveValue(this.path, value);
}
await batch.write(); await batch.write();
this.database.changeObservable.send({ this.database.changeObservable.send({

View File

@ -36,8 +36,6 @@ Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
}); });
const formsTemplate = Handlebars.compile(readFileSync("./views/forms.hbs").toString());
const cache = new Map<string, Handlebars.TemplateDelegate>(); const cache = new Map<string, Handlebars.TemplateDelegate>();
export default function getTemplate(name: string) { export default function getTemplate(name: string) {