fix(canvas): keep the block-type tag naming its type after a rename

The header tag dropped its label whenever the block's title already said the
same word, so the same block read two ways depending on nothing the user did
deliberately: a freshly dropped Wait showed a bare icon, and its second copy —
auto-named "Wait 2" — showed "Wait". The tag looked like a badge that appeared
on rename rather than a fixed part of the header.

It now always names the type, which is what loop and parallel containers already
do with their own tag, so every card on the canvas reads the same way.

`blockName` was only ever read for that comparison, so the prop is gone rather
than left behind for a future reader to wonder about.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vikhyath Mondreti
2026-08-08 17:47:17 -07:00
co-authored by Claude Opus 5
parent 9c71860c6d
commit aa2139ae0f
3 changed files with 28 additions and 7 deletions
@@ -510,7 +510,6 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
<WorkflowTypeTag
type={type}
typeLabel={canvasPresentation.typeLabel}
blockName={canvasPresentation.title}
Icon={IconComponent}
iconBgColor={blockConfig.bgColor}
isIntegration={blockConfig.category === 'tools'}
@@ -257,7 +257,6 @@ describe('WorkflowTypeTag colors', () => {
<WorkflowTypeTag
type='airweave'
typeLabel='Airweave'
blockName='Search Collections'
Icon={TestIcon}
iconBgColor='#6366F1'
isIntegration
@@ -275,7 +274,6 @@ describe('WorkflowTypeTag colors', () => {
<WorkflowTypeTag
type='gmail'
typeLabel='Gmail'
blockName='Send Email'
Icon={TestIcon}
iconBgColor='#FFFFFF'
isIntegration
@@ -287,4 +285,24 @@ describe('WorkflowTypeTag colors', () => {
expect(lightTag).toHaveStyle({ background: '#FFFFFF' })
expect(lightTag).toHaveClass('text-[#000000]')
})
/**
* The label used to drop out whenever the block's title already said the same
* word, so a freshly dropped Wait showed a bare icon and its second copy —
* named "Wait 2" — showed "Wait". The tag names the block's kind; it is not a
* badge that appears on rename.
*/
it('names the block type even when the title already says it', () => {
const host = document.createElement('div')
document.body.appendChild(host)
const root = createRoot(host)
mountedRoots.add(root)
mountedHosts.add(host)
act(() =>
root.render(<WorkflowTypeTag type='wait' typeLabel='Wait' Icon={TestIcon} iconBgColor='' />)
)
expect(host.querySelector<HTMLElement>('[data-workflow-type-accent]')).toHaveTextContent('Wait')
})
})
@@ -205,7 +205,6 @@ export function WorkflowTypeIcon({ type, Icon, className, ...props }: WorkflowTy
export interface WorkflowTypeTagProps {
type: string
typeLabel?: string
blockName: string
Icon: ComponentType<{ className?: string }>
iconBgColor: string
isIntegration?: boolean
@@ -216,7 +215,6 @@ export interface WorkflowTypeTagProps {
export function WorkflowTypeTag({
type,
typeLabel,
blockName,
Icon,
iconBgColor,
isIntegration = false,
@@ -227,7 +225,14 @@ export function WorkflowTypeTag({
'flex-shrink-0 justify-center transition-opacity duration-150 [transition-timing-function:cubic-bezier(0.23,1,0.32,1)]',
!isEnabled && 'opacity-50'
)
const label = typeLabel && typeLabel !== blockName ? typeLabel : null
/*
* The tag names the block's kind, and it says so whether or not the title
* happens to repeat it. Dropping the label when the two matched meant a card
* changed shape the moment it was renamed — a freshly dropped Wait showed a
* bare icon, its second copy showed "Wait" — so the tag read as a badge that
* came and went rather than as one fixed part of the header.
*/
const label = typeLabel || null
if (isIntegration) {
return (
@@ -927,7 +932,6 @@ export function WorkflowBlockView({
<WorkflowTypeTag
type={type}
typeLabel={typeLabel}
blockName={name}
Icon={Icon}
iconBgColor={iconBgColor}
isIntegration={isIntegration}