diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts index a7a24a31b2..7d626c51e8 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts @@ -30,7 +30,7 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set block.type === 'starter' || block.type === 'start_trigger' ) - if (starterBlock) { + if (starterBlock && ancestorIds.includes(starterBlock.id)) { accessibleIds.add(starterBlock.id) } diff --git a/apps/sim/lib/block-path-calculator.ts b/apps/sim/lib/block-path-calculator.ts index fd9a8d4cbb..939e474684 100644 --- a/apps/sim/lib/block-path-calculator.ts +++ b/apps/sim/lib/block-path-calculator.ts @@ -85,9 +85,10 @@ export class BlockPathCalculator { const pathNodes = BlockPathCalculator.findAllPathNodes(workflow.connections, block.id) pathNodes.forEach((nodeId) => accessibleBlocks.add(nodeId)) - // Always allow referencing the starter block (special case) + // Only add starter block if it's actually upstream (already in pathNodes) + // Don't add it just because it exists on the canvas const starterBlock = workflow.blocks.find((b) => b.metadata?.id === 'starter') - if (starterBlock && starterBlock.id !== block.id) { + if (starterBlock && starterBlock.id !== block.id && pathNodes.includes(starterBlock.id)) { accessibleBlocks.add(starterBlock.id) } diff --git a/apps/sim/serializer/index.ts b/apps/sim/serializer/index.ts index 6232ff276c..574b6e72e7 100644 --- a/apps/sim/serializer/index.ts +++ b/apps/sim/serializer/index.ts @@ -592,7 +592,9 @@ export class Serializer { const accessibleIds = new Set(ancestorIds) accessibleIds.add(blockId) - if (starterBlock) { + // Only add starter block if it's actually upstream (already in ancestorIds) + // Don't add it just because it exists on the canvas + if (starterBlock && ancestorIds.includes(starterBlock.id)) { accessibleIds.add(starterBlock.id) }