Skip to content

fix: truncate long node names in workflow execution details - #8298

Merged
wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_truncate
Dec 4, 2026
Merged

wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_truncate

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: truncate long node names in workflow execution details

<div class="flex-align-center shrink-0 gap-3 text-N600">
<span v-if="showTokens">{{ formatTokenNumber(tokenCount) }} tokens</span>
<span v-if="!isRunning">{{ data?.run_time?.toFixed(2) || '0.00' }} s</span>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my review of the diff:

Observations

1. data.name — inconsistent optional chaining

  • The template uses {{ data.name }}, :title="data.name", and data?.run_time (with ?.). If data can be undefined, data.name will throw. Make it consistent: use data?.name (and :title="data?.name"), or ensure data is always defined via a prop validator/required: true.

2. Truncation requires both parent and element to shrink

  • You correctly added min-w-0 on both containers and shrink-0 on the icon/suffix — good.
  • However, <h6 class="truncate"> needs min-w-0 too (or overflow: hidden) in some flex layouts. Tailwind's truncate includes overflow-hidden; text-overflow: ellipsis; white-space: nowrap, but if h6 is itself a flex item inside .flex-align-center, adding min-w-0 explicitly to it is safer.

3. Layout structure mismatch

  • Outer container is flex-between (presumably justify-content: space-between), and you added gap-2. With justify-content: space-between the gap has no effect when the two children fill the width, and truncation works because the left group shrinks. Consider using justify-between + min-w-0 is fine, but double-check the .flex-between utility doesn't also set align-items incorrectly for your icon alignment.

4. :size="24" vs class="shrink-0"

  • Fine, but verify the component forwards class and size to its root element (Vue fallthrough). If nodeIconComponent is a fragment or doesn't inheritAttrs, shrink-0 may be dropped silently.

5. Accessibility

  • :title="data.name" gives a native tooltip, which is acceptable, but consider a real tooltip component for keyboard/touch accessibility. Also add aria-label if the truncated text is critical.

6. Unchanged line — potential issue

  • <span v-if="!isRunning">{{ data?.run_time?.toFixed(2) || '0.00' }} s</span> — toFixed returns a string like "0.00", which is truthy, so || '0.00' only triggers when toFixed is skipped (undefined/null run_time). That's fine, but 0 → "0.00" is also truthy, so behavior is correct. No change needed, just confirming intent.

7. tokenCount (context)

  • (props.data?.message_tokens || 0) + ... — using || vs ?? is harmless for numbers here; but if a token value could legitimately be 0, both behave the same. Prefer ?? 0 for clarity/consistency.

Suggested refined snippet

<div class="flex-between min-w-0 w-full gap-2">
  <div class="flex-align-center min-w-0 gap-2">
    <component :is="nodeIconComponent" v-if="nodeIconComponent" class="shrink-0" :size="24" />
    <h6 class="min-w-0 truncate" :title="data?.name">{{ data?.name }}</h6>
  </div>
  <div class="flex-align-center shrink-0 gap-3 text-N600">
    ...

Summary

The changes are directionally correct for handling long names via truncation. Main fixes: (a) consistent optional chaining on data, (b) ensure min-w-0 on the <h6> itself, (c) verify class fallthrough on the dynamic component.

@wangdan-fit2cloud
wangdan-fit2cloud merged commit 44cac30 into v3 Dec 4, 2026
3 of 4 checks passed
@wangdan-fit2cloud
wangdan-fit2cloud deleted the pr@v3@fix_truncate branch December 4, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants