Skip to content

Commit 019b407

Browse files
committed
fix(tag-dropdown): exclude downstream blocks in loops and parallel siblings from reference picker
1 parent 132fef0 commit 019b407

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
3636
loopValues.forEach((loop) => {
3737
if (!loop?.nodes) return
3838
if (loop.nodes.includes(blockId)) {
39-
accessibleIds.add(loop.id) // Add the loop block itself
40-
loop.nodes.forEach((nodeId) => accessibleIds.add(nodeId))
39+
accessibleIds.add(loop.id)
40+
loop.nodes.forEach((nodeId) => {
41+
if (ancestorIds.includes(nodeId)) {
42+
accessibleIds.add(nodeId)
43+
}
44+
})
4145
}
4246
})
4347

4448
const parallelValues = Object.values(parallels as Record<string, Parallel>)
4549
parallelValues.forEach((parallel) => {
4650
if (!parallel?.nodes) return
4751
if (parallel.nodes.includes(blockId)) {
48-
accessibleIds.add(parallel.id) // Add the parallel block itself
49-
parallel.nodes.forEach((nodeId) => accessibleIds.add(nodeId))
52+
accessibleIds.add(parallel.id)
5053
}
5154
})
5255

0 commit comments

Comments
 (0)