function mergeEntities(entities, newEntities) {
  entities = { ...entities };
  for (const id in newEntities) {
    if (newEntities[id] === null) {
      delete entities[id];
    } else {
      entities[id] = { ...entities[id], ...newEntities[id] };
    }
  }
  return entities;
}
// this ensures partial entities don't overwrite existing entities with more properties
this ensures partial entities don't overwrite existing entities with more properties
this ensures partial entities don ' t overwrite existing entities with more properties
function mergeEntities(entities, newEntities) {
  entities = { ...entities };
  for (const id in newEntities) {
    if (newEntities[id] === null) {
      delete entities[id];
    } else {
      entities[id] = { ...entities[id], ...newEntities[id] };
    }
  }
  return entities;
}
function mergeEntities ( entities , newEntities ) { entities = { ... entities } ; for ( const id in newEntities ) { if ( newEntities [ id ] === null ) { delete entities [ id ] ; } else { entities [ id ] = { ... entities [ id ] , ... newEntities [ id ] } ; } } return entities ; }
this ensures partial entities don't overwrite existing entities with more properties
this ensures partial entities don ' t overwrite existing entities with more properties