diff --git a/packages/erd-editor-app/src/services/indexeddb/modules/schema/service.ts b/packages/erd-editor-app/src/services/indexeddb/modules/schema/service.ts index 88dee440..55a4bf88 100644 --- a/packages/erd-editor-app/src/services/indexeddb/modules/schema/service.ts +++ b/packages/erd-editor-app/src/services/indexeddb/modules/schema/service.ts @@ -27,7 +27,7 @@ export class SchemaService { store.setInitialValue(entity.value); store.on({ change: () => { - this.update(entity.id, { value: store.value }); + updateSchemaEntity(this.db, entity.id, { value: store.value }); }, }); this.cache.set(entity.id, { ...entity, store }); @@ -45,8 +45,8 @@ export class SchemaService { entityValue: Partial> ) { const result = await updateSchemaEntity(this.db, id, entityValue); - const prev = this.cache.get(id); + if (prev && result) { this.cache.set(id, { ...prev, ...entityValue });