From 515c631618e9642e2ff2085246c317f9f62f27fc Mon Sep 17 00:00:00 2001 From: Bob Obringer Date: Tue, 13 Jan 2026 20:58:21 -0500 Subject: [PATCH] fix(button): add "use client" directive for RSC compatibility Button uses @base-ui/react which requires client-side rendering. When Button was used in Server Components that called router.refresh(), it would crash with "Element type is invalid" error because base-ui primitives don't work in server context. Adding "use client" ensures the Button component is always rendered on the client side, fixing the crash. Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- src/components/ui/button.tsx | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe56f31..004bdfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to `@neynar/ui` will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.5] - 2025-01-13 + +### Fixed +- **Button**: Added `"use client"` directive to fix crash when Button is used in Server Components that call `router.refresh()`. Base UI primitives require client-side rendering. + +--- + ## [1.0.4] - 2025-01-11 ### Fixed diff --git a/package.json b/package.json index 109c227..35cbb41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/ui", - "version": "1.0.4", + "version": "1.0.5", "license": "MIT", "author": "Neynar Inc.", "description": "AI-first React component library for coding agents. LLM-optimized docs, sensible defaults, zero config. Built on shadcn patterns, Base UI, and Tailwind CSS v4.", diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 01313f9..08d81f6 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,3 +1,5 @@ +"use client"; + import { Button as ButtonPrimitive } from "@base-ui/react/button"; import { cva, type VariantProps } from "class-variance-authority";