Skip to content

Conversation

@MatGros
Copy link

@MatGros MatGros commented Jan 8, 2026

Summary

  • Fix fatal crash: TextNodeRenderable only accepts strings, TextNodeRenderable instances, or StyledText instances

Changes

  • Line 1817 (Patch component): Remove optional chaining ?. on props.output since the <Match when={props.output !== undefined}> guard already ensures it's defined. Use non-null assertion ! instead.
  • Line 1232 (error message display): Add nullish coalescing ?? "" for error.data?.message to provide empty string fallback when data is undefined.

Root Cause

The <text> component from @opentui/core only accepts strings, TextNodeRenderable instances, or StyledText instances. Optional chaining (?.) can return undefined even inside guarded blocks, causing the runtime error.

Testing

The fix ensures all <text> children are guaranteed to be strings:

  • props.output!.trim() - Safe because Match guard checks props.output !== undefined
  • props.message.error?.data?.message ?? "" - Falls back to empty string

- Line 1817: Remove optional chaining on props.output since Match guard
  already ensures it's defined, use non-null assertion instead
- Line 1232: Add nullish coalescing for error.data.message to provide
  empty string fallback

Fixes crash: 'TextNodeRenderable only accepts strings, TextNodeRenderable
instances, or StyledText instances'
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

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.

1 participant