From 594a8e296551fd949b2f0a2b0787845e79ed6677 Mon Sep 17 00:00:00 2001 From: Daniel Haupt Date: Mon, 18 Mar 2024 11:39:42 +0100 Subject: [PATCH] fix: respect data path for relation results closes: #9 --- src/lib/nestedOperations.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/nestedOperations.ts b/src/lib/nestedOperations.ts index 4bab695..26495da 100644 --- a/src/lib/nestedOperations.ts +++ b/src/lib/nestedOperations.ts @@ -86,10 +86,10 @@ export function withNestedOperations< // add id symbols to result so we can use them to update result relations // with the results from nested middleware addIdSymbolsToResult(result); - + const dataPath = rootParams.__internalParams.dataPath; const nestedNextResults = await Promise.all( calls.map(async (call) => { - const relationsPath = buildTargetRelationPath(call.target); + const relationsPath = buildTargetRelationPath(call.target).filter(path => !dataPath.includes(path)); if (result === null || !relationsPath) { call.queryPromise.resolve(undefined);