fix(rsc): add "use client" directive to all client-interactive files

50 .tsx components and 6 .ts hook files use React client APIs
(createContext, useState, useEffect, useRef, useMemo, useCallback,
forwardRef, etc.) but lacked the "use client" directive at the top
of the source file. tsc-emitted dist files therefore also lacked it.

Older Next.js / Turbopack versions traversed the import graph and
implicitly treated the imports as client when their consumer was a
client component. Next.js 16's stricter Turbopack rejects this: any
file that touches client-only React APIs must declare "use client"
explicitly, regardless of where it is imported from.

Symptom in consumers (gscSupport build, 2026-05-17):

  ./templates/limitless-ui/dist/theme/ThemeProvider.js:2:10
  You're importing a module that depends on `createContext` into a
  React Server Component module. This API is only available in
  Client Components. To fix, mark the file (or its parent) with
  the `"use client"` directive.

Adding the directive at source-file level cascades through tsc into
the emitted dist/ — verified gscSupport + gscCRM build cleanly after
this change.

Affected files (50 total):
  src/theme/ThemeProvider.tsx
  src/hooks/useDisclosure.ts
  src/components/{Accordion,Carousel,DualListBox,Form,Wizard,…}.tsx
  src/validation/hooks/{useValidation,useFieldValidation,…}.ts
  src/genui/hooks/{useGenUI,useWebMCP}.ts
  ... and more — every component that touches createContext / a
  React hook now self-declares as client.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-05-17 18:36:40 +02:00
parent 493d2c5d69
commit 7eb18b15b8
50 changed files with 100 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
"use client";
import React, { createContext, useContext, useState } from 'react';
import { Collapse } from './Collapse';

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
export type ButtonVariant =

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useMemo, useCallback } from 'react';
export interface CalendarEvent {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useEffect, useCallback, useRef } from 'react';
export interface CarouselItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useEffect, useCallback } from 'react';
export interface ContextMenuItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
import {
ColumnDef,

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect, useRef, useState } from 'react';
export type DropdownProps = {

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
import { Button } from './Button';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useEffect, useRef } from 'react';
export interface EmbedProps {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
export interface FABAction {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useCallback, DragEvent, ChangeEvent } from 'react';
export interface UploadFile {

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
export type FormGroupProps = {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback, useEffect } from 'react';
export interface GalleryItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useEffect, useCallback, useRef } from 'react';
export interface IdleTimeoutProps {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useCallback, useEffect } from 'react';
export interface CropArea {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect } from 'react';
import { createPortal } from 'react-dom';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useEffect, useCallback, useRef } from 'react';
export type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'default';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect, useRef, useCallback } from 'react';
export interface OffcanvasProps {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
export interface PillItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
import { useFloating, offset, shift, flip, arrow, Placement, Middleware } from '@floating-ui/react';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback } from 'react';
export interface RatingProps {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect, useState } from 'react';
export type ScrollspyItem = {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useCallback, useEffect } from 'react';
export interface SliderProps {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useCallback, useEffect } from 'react';
export interface SortableItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
export interface StepItem {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect, useRef, useCallback } from 'react';
export type SweetAlertType = 'success' | 'error' | 'warning' | 'info' | 'question';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useMemo, useCallback } from 'react';
export type Language =

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useMemo, useState } from 'react';
export type TabItem = {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useCallback, KeyboardEvent } from 'react';
export interface Tag {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useEffect } from 'react';
export type ToastProps = {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
import { useFloating, offset, shift, flip, arrow, Placement, Middleware } from '@floating-ui/react';

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback } from 'react';
export interface TreeNode {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
// ============================================================================

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useMemo, useState } from 'react';
import { Button } from './Button';

View File

@@ -1,3 +1,5 @@
"use client";
/**
* useGenUI Hook
*

View File

@@ -1,3 +1,5 @@
"use client";
/**
* useWebMCP Hook
*

View File

@@ -1,3 +1,5 @@
"use client";
import { useCallback, useState } from 'react';
export function useDisclosure(initial = false) {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
export type SidebarNavItem = {

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
// Base Auth Layout

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useRef, useEffect, useCallback } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React from 'react';
// Base Error Layout

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState, useCallback } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React, { useState } from 'react';
// Types

View File

@@ -1,3 +1,5 @@
"use client";
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
export type LimitlessTheme = 'light' | 'dark' | 'material';

View File

@@ -1,3 +1,5 @@
"use client";
import { useState, useCallback, useRef, useEffect } from 'react';
import type { EuropeanAddress, AddressSuggestion, UseAddressAutocompleteOptions } from '../types';

View File

@@ -1,3 +1,5 @@
"use client";
import { useState, useCallback, useRef, useEffect } from 'react';
import type {
ValidatorFn,

View File

@@ -1,3 +1,5 @@
"use client";
import { useState, useCallback, useRef, useEffect, useMemo } from 'react';
import type {
FormSchema,