Skip to content

Commit de8ef28

Browse files
committed
fix(tag-dropdown): restore parallel container in accessible references for blocks inside parallel
1 parent 68bc9f6 commit de8ef28

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import { BlockPathCalculator } from '@/lib/workflows/blocks/block-path-calculato
44
import { SYSTEM_REFERENCE_PREFIXES } from '@/lib/workflows/sanitization/references'
55
import { normalizeName } from '@/executor/constants'
66
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
7-
import type { Loop } from '@/stores/workflows/workflow/types'
7+
import type { Loop, Parallel } from '@/stores/workflows/workflow/types'
88

99
export function useAccessibleReferencePrefixes(blockId?: string | null): Set<string> | undefined {
10-
const { blocks, edges, loops } = useWorkflowStore(
10+
const { blocks, edges, loops, parallels } = useWorkflowStore(
1111
useShallow((state) => ({
1212
blocks: state.blocks,
1313
edges: state.edges,
1414
loops: state.loops || {},
15+
parallels: state.parallels || {},
1516
}))
1617
)
1718

@@ -25,12 +26,12 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
2526
const accessibleIds = new Set<string>(ancestorIds)
2627
accessibleIds.add(blockId)
2728

28-
const loopValues = Object.values(loops as Record<string, Loop>)
29-
loopValues.forEach((loop) => {
30-
if (!loop?.nodes) return
31-
if (loop.nodes.includes(blockId)) {
32-
accessibleIds.add(loop.id)
33-
}
29+
Object.values(loops as Record<string, Loop>).forEach((loop) => {
30+
if (loop?.nodes?.includes(blockId)) accessibleIds.add(loop.id)
31+
})
32+
33+
Object.values(parallels as Record<string, Parallel>).forEach((parallel) => {
34+
if (parallel?.nodes?.includes(blockId)) accessibleIds.add(parallel.id)
3435
})
3536

3637
const prefixes = new Set<string>()
@@ -45,5 +46,5 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
4546
SYSTEM_REFERENCE_PREFIXES.forEach((prefix) => prefixes.add(prefix))
4647

4748
return prefixes
48-
}, [blockId, blocks, edges, loops])
49+
}, [blockId, blocks, edges, loops, parallels])
4950
}

0 commit comments

Comments
 (0)