Skip to content

Commit 0325420

Browse files
committed
resilience when reference ids is not list but str
1 parent 850e710 commit 0325420

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/database/project/index.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ class Project {
8282
for await (const [referenceName, reference] of Object.entries(REFERENCES)) {
8383
// Set a nested value miner
8484
const valueGetter = getValueGetter(reference.projectIdsField);
85-
const projectReferenceIds = valueGetter(this.data);
85+
let projectReferenceIds = valueGetter(this.data);
8686
// If there are no references then send an empty list
8787
if (!projectReferenceIds || projectReferenceIds.length == 0) continue;
88+
// DANI: projectReferenceIds debería ser una lista, pero por si acaso es un string...
89+
if (typeof projectReferenceIds === 'string') projectReferenceIds = [projectReferenceIds];
8890
// Set up the db query with all reference ids
8991
const queries = projectReferenceIds.map(referenceId => {
9092
return { [reference.idField]: referenceId };

0 commit comments

Comments
 (0)