Skip to content

Commit

Permalink
fix: Empty should default to the provided Text component (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Sep 14, 2024
1 parent f0f7497 commit 892b019
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-pandas-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@assistant-ui/react": patch
---

fix: Empty should default to the provided Text component
4 changes: 2 additions & 2 deletions packages/react/src/primitives/message/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ type MessageContentPartComponentProps = {

const MessageContentPartComponent: FC<MessageContentPartComponentProps> = ({
components: {
Empty = defaultComponents.Text,
Text = defaultComponents.Text,
Empty = Text,
Image = defaultComponents.Image,
UI = defaultComponents.UI,
tools: { by_name = {}, Fallback = undefined } = {},
Expand All @@ -93,7 +93,7 @@ const MessageContentPartComponent: FC<MessageContentPartComponentProps> = ({
case "text":
if (status.type === "requires-action")
throw new Error("Encountered unexpected requires-action status");
if (part === EMPTY_CONTENT) return <Empty status={status} />;
if (part === EMPTY_CONTENT) return <Empty part={part} status={status} />;

return <Text part={part} status={status} />;

Expand Down

0 comments on commit 892b019

Please sign in to comment.