vercel / vercel/ai-elements

ToolOutput component is wrongly hidden when the tool message result is a empty string

Open Beginner friendly
#399 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
283
Avg merge
32m
Merged PRs (30d)
1

Description

Currently the ToolOutput component implementation has a guard statement:

export const ToolOutput = ({
  className,
  output,
  errorText,
  ...props
}: ToolOutputProps) => {
  if (!(output || errorText)) {
    return null;
  }
  ...

The expression !(output || errorText) will wrongly returns true when the output is an empty string.
And for example, I have a read_file tool, and the agent use it to read a empty text file, sometimes the tool implementation will return an empty string here, and this expression will make the tool result be hidden.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ToolOutput component implementation shown in the issue and inspect its guard and rendering path. Confirm that an empty-string result is displayed while missing output and error text remain hidden, then verify the behavior with the component's relevant checks or reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.