From da2406047d4131b98f23521441f548d169fb726f Mon Sep 17 00:00:00 2001 From: deeonwuli Date: Mon, 12 Feb 2024 14:00:56 +0100 Subject: [PATCH] fix: return correct children when building landing node --- src/data/repositories/LandingNodeDefaultRepository.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/data/repositories/LandingNodeDefaultRepository.ts b/src/data/repositories/LandingNodeDefaultRepository.ts index d64d7d8..83c88f5 100644 --- a/src/data/repositories/LandingNodeDefaultRepository.ts +++ b/src/data/repositories/LandingNodeDefaultRepository.ts @@ -32,7 +32,12 @@ export class LandingNodeDefaultRepository implements LandingNodeRepository { : []; const validations = roots.map(root => - LandingNodeModel.decode(buildDomainLandingNode(root, _.flatten(persisted))) + LandingNodeModel.decode( + buildDomainLandingNode( + root, + persisted.find(model => model.find(item => item.parent === root.id)) ?? [] + ) + ) ); _.forEach(validations, validation => {