From 69d7684b0dbdfc0482165e2caaf564438ad21dff Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 22 Feb 2023 22:10:41 +0100 Subject: [PATCH] fix refreshing option cache on sync, closes #3623 --- src/becca/becca_loader.js | 2 +- src/becca/entities/boption.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/becca/becca_loader.js b/src/becca/becca_loader.js index c5eaa35e2..ad4c90a10 100644 --- a/src/becca/becca_loader.js +++ b/src/becca/becca_loader.js @@ -84,7 +84,7 @@ eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entity return; } - if (["notes", "branches", "attributes", "etapi_tokens"].includes(entityName)) { + if (["notes", "branches", "attributes", "etapi_tokens", "options"].includes(entityName)) { const EntityClass = entityConstructor.getEntityFromEntityName(entityName); const primaryKeyName = EntityClass.primaryKeyName; diff --git a/src/becca/entities/boption.js b/src/becca/entities/boption.js index a33911a01..0188d9f7e 100644 --- a/src/becca/entities/boption.js +++ b/src/becca/entities/boption.js @@ -16,6 +16,11 @@ class BOption extends AbstractBeccaEntity { constructor(row) { super(); + this.updateFromRow(row); + this.becca.options[this.name] = this; + } + + updateFromRow(row) { /** @type {string} */ this.name = row.name; /** @type {string} */ @@ -24,8 +29,6 @@ class BOption extends AbstractBeccaEntity { this.isSynced = !!row.isSynced; /** @type {string} */ this.utcDateModified = row.utcDateModified; - - this.becca.options[this.name] = this; } beforeSaving() {