Skip to content

Commit fca92a7

Browse files
authored
fix(tags): only show start block upstream if is ancestor (#2013)
1 parent c25ea5c commit fca92a7

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
3030
const starterBlock = Object.values(blocks).find(
3131
(block) => block.type === 'starter' || block.type === 'start_trigger'
3232
)
33-
if (starterBlock) {
33+
if (starterBlock && ancestorIds.includes(starterBlock.id)) {
3434
accessibleIds.add(starterBlock.id)
3535
}
3636

apps/sim/lib/block-path-calculator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ export class BlockPathCalculator {
8585
const pathNodes = BlockPathCalculator.findAllPathNodes(workflow.connections, block.id)
8686
pathNodes.forEach((nodeId) => accessibleBlocks.add(nodeId))
8787

88-
// Always allow referencing the starter block (special case)
88+
// Only add starter block if it's actually upstream (already in pathNodes)
89+
// Don't add it just because it exists on the canvas
8990
const starterBlock = workflow.blocks.find((b) => b.metadata?.id === 'starter')
90-
if (starterBlock && starterBlock.id !== block.id) {
91+
if (starterBlock && starterBlock.id !== block.id && pathNodes.includes(starterBlock.id)) {
9192
accessibleBlocks.add(starterBlock.id)
9293
}
9394

apps/sim/serializer/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,9 @@ export class Serializer {
592592
const accessibleIds = new Set<string>(ancestorIds)
593593
accessibleIds.add(blockId)
594594

595-
if (starterBlock) {
595+
// Only add starter block if it's actually upstream (already in ancestorIds)
596+
// Don't add it just because it exists on the canvas
597+
if (starterBlock && ancestorIds.includes(starterBlock.id)) {
596598
accessibleIds.add(starterBlock.id)
597599
}
598600

0 commit comments

Comments
 (0)