small refactoring

This commit is contained in:
zadam
2021-08-26 22:10:59 +02:00
parent d0747b125c
commit 635f5fdc5b
2 changed files with 11 additions and 11 deletions

View File

@@ -60,7 +60,7 @@ function postProcessEntityUpdate(entityName, entity) {
}
}
eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entity}) => {
eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
if (!becca.loaded) {
return;
}
@@ -69,18 +69,18 @@ eventService.subscribe([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entit
const EntityClass = entityConstructor.getEntityFromEntityName(entityName);
const primaryKeyName = EntityClass.primaryKeyName;
let beccaEntity = becca.getEntity(entityName, entity[primaryKeyName]);
let beccaEntity = becca.getEntity(entityName, entityRow[primaryKeyName]);
if (beccaEntity) {
beccaEntity.updateFromRow(entity);
beccaEntity.updateFromRow(entityRow);
} else {
beccaEntity = new EntityClass();
beccaEntity.updateFromRow(entity);
beccaEntity.updateFromRow(entityRow);
beccaEntity.init();
}
}
postProcessEntityUpdate(entityName, entity);
postProcessEntityUpdate(entityName, entityRow);
});
eventService.subscribe(eventService.ENTITY_CHANGED, ({entityName, entity}) => {