fixes in frontend sync

This commit is contained in:
zadam
2021-08-14 10:13:59 +02:00
parent b619a6515b
commit 9d9bc31d91
2 changed files with 157 additions and 111 deletions

View File

@@ -69,14 +69,14 @@ eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entit
const EntityClass = entityConstructor.getEntityFromEntityName(entityName);
const primaryKeyName = EntityClass.primaryKeyName;
let entity = becca.getEntity(entityName, entity[primaryKeyName]);
let beccaEntity = becca.getEntity(entityName, entity[primaryKeyName]);
if (entity) {
entity.updateFromRow(entity);
if (beccaEntity) {
beccaEntity.updateFromRow(entity);
} else {
entity = new EntityClass();
entity.updateFromRow(entity);
entity.init();
beccaEntity = new EntityClass();
beccaEntity.updateFromRow(entity);
beccaEntity.init();
}
}