Skip to content
Source
Sign inSign up
TanStack/charts

React adapter entries have no `"use client"` directive, and the docs do not cover the Next.js App Router #176

Closedquantizor(GitHub profile, opens in a new tab) opened this issue 1 comment

Version: @tanstack/charts 1.0.0.

The files under dist/react/ carry no "use client" directive, and no docs page mentions the App Router or server components. RendererChart uses useRef, useSyncExternalStore and useLayoutEffect/useEffect, none of which React 19.3.0 exports under the react-server condition (checked with node --conditions=react-server). Importing Chart from a server module should therefore fail with an error about React internals rather than one that says to add a client boundary. This is from reading the published dist and React's server build, not a Next.js run.

Wrapping the chart in a file marked "use client" works, and is needed anyway, because a definition holds functions and scale instances that cannot pass from a server component.

Would it be possible to put the directive on the React adapter entries (Chart, RendererChart, CanvasChart, the tooltip entry), if the build preserves directives? A short App Router note in the React adapter docs would also help: build definitions in a client module and render Chart there.

  1. Shipped in 1.1.0. The React entries now preserve "use client" in the published output, and the adapter guide covers defining charts inside a client module. Verification covers compiled and packed entries; we did not run a separate Next.js application build.

  2. tannerlinsley closed this

Sign in to join this conversation.