Charts component crashes with TypeError during streaming: null data passed to Recharts

オープン
#355 コメント 5 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ankit-thesys がすでに取り組んでいます。

2026年6月15日 から。

  • #487 @Sh-dheeraj による — マージされずにクローズ
  • #569 @MD-Mushfiqur123 による — マージされずにクローズ
  • #651 @serhiizghama による — マージされずにクローズ
  • #760 @AliMahmoudDev による — マージされずにクローズ

評価

この issue はまだ評価されていません。

説明

bug good first issue

Bug Description

The built-in Charts component in @openuidev/react-ui throws a TypeError: Cannot read properties of null (reading 'map') during streaming rendering. The error originates from Recharts' CategoricalChartWrapper.render() when the OpenUI Renderer passes partial/incomplete data to the chart component before the full dataset has streamed in.

Steps to Reproduce

  1. Scaffold a new project: npx @openuidev/cli@latest create --name test-app
  2. Configure an LLM provider (OpenRouter with Claude Sonnet 4 in my case)
  3. Send a prompt that generates a chart, e.g.: "Show me a CEO dashboard with quarterly revenue data for 4 regions"
  4. Observe the console error during streaming

Error Stack Trace

TypeError: Cannot read properties of null (reading 'map')
    at CategoricalChartWrapper.render (recharts/es6/chart/...)
    at renderByOrder (recharts/es6/util/...)
    at RenderNode (@openuidev/...)
    at renderDeep (@openuidev/...)
    at Charts component (@openuidev/react-ui/dist/genui-lib/...)
    at GenUIAssistantMessage (...)

Expected Behavior

The Charts component should guard against null/undefined data during progressive streaming. A simple data ?? [] fallback before passing to Recharts would prevent this.

Actual Behavior

The chart eventually renders correctly after streaming completes, but the console error fires during the streaming phase when the chart structure arrives before its data array.

Environment

  • @openuidev/react-ui: latest (installed 2026-03-18)
  • @openuidev/react-lang: latest
  • @openuidev/react-headless: latest
  • Next.js 16.1.6 (Turbopack)
  • React 19.2.3
  • LLM: Claude Sonnet 4 via OpenRouter
  • OS: Windows 11

Suggested Fix

In the Charts genui-lib component, add a null guard before passing data to Recharts:

// Before passing to <BarChart data={data}>
const safeData = data ?? [];

Additional Note

The FullScreen component also defaults logoUrl to https://crayonai.org/img/logo.png which appears to be a dead URL from the Crayon AI rebrand, causing broken image icons in the header and assistant avatar. Consider updating the default or removing it.

主要言語
TypeScript
スター
10k
フォーク
698
平均マージ
1日 2時間
マージ済み PR(30日)
138

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

thesysdev/openui のほかの issue

thesysdev/openui の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。