Skip to content

Commit

Permalink
fix reconnect, it was working with relations instead of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Aug 16, 2024
1 parent dd28210 commit 7db7d19
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions js/filters/reconnect/mcparticletree.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ const findParticles = (otherObject, relationName, ids) => {
}

const relations = oneToManyRelations[relationName];
const relationObjects = relations.map((relation) => relation.to);

if (relations.length === 0) return [];
if (relationObjects.length === 0) return [];

let hasAny = 0;

relations.forEach((object) =>
ids.has(`${object.index}-${object.collectionId}`) ? (hasAny += 1) : null
relationObjects.filter((object) =>
ids.has(`${object.index}-${object.collectionId}`)
);

return hasAny > 0
? relations
: relations
.map((parentLink) => findParticles(parentLink.to, relationName, ids))
return relationObjects.length > 0
? relationObjects
: relationObjects
.map((object) => findParticles(object, relationName, ids))
.flat();
};

Expand Down

0 comments on commit 7db7d19

Please sign in to comment.