Skip to content

feat: ship "use client" on stateful components - #66

Merged
TheGreatAxios merged 1 commit into
cl-9080-react-ui-move-dark-mode-paragraphs-from-quickstart-to-afrom
cl-9103-react-ui-ship-use-client-directives-on-stateful-components
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9080-react-ui-move-dark-mode-paragraphs-from-quickstart-to-afrom
cl-9103-react-ui-ship-use-client-directives-on-stateful-components

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #69. Merge after it.

  • 45 ui/ and blocks/ modules start with "use client": the ones that call a hook, create a context, define an inline event handler, or import an optional peer. SWC keeps the directive in dist/, so a React Server Components app imports them without its own client wrapper. Outside RSC the directive is a no-op. Vite logs the same "module level directives" warning it logs for Radix.
  • dep-guard rule 3 fails when a component's directive does not match what it does. It builds the peer pattern from OPTIONAL_PEERS, ignores comments, and catches generic hook calls (useState<T>(). After a build it also fails when a marked module's dist/ file lost the directive, and bun run build now ends with dep-guard.
  • The README, ARCHITECTURE and CONTRIBUTING describe the rule.
  • New stateful components in feat(ui): primitives for the stage-workspace port #58/feat(chat): optional attachIcon and sendIcon on ChatInput #59 need the directive once this lands. dep-guard flags them.

Verification

typecheck, lint, dep-guard, bun test and bun run build pass. Deleting the directive from a built dist/ui/switch.js makes dep-guard fail. A Vite production build and the Playwright suite pass against the packed tarball of the merged stack.

Closes CL-9103

@TheGreatAxios
TheGreatAxios force-pushed the cl-9103-react-ui-ship-use-client-directives-on-stateful-components branch 2 times, most recently from 9d39c69 to b4e1795 Compare September 25, 2026 21:55
@TheGreatAxios
TheGreatAxios changed the base branch from main to cl-9080-react-ui-move-dark-mode-paragraphs-from-quickstart-to-a September 25, 2026 21:55
@TheGreatAxios
TheGreatAxios force-pushed the cl-9103-react-ui-ship-use-client-directives-on-stateful-components branch from b4e1795 to c5ab71f Compare September 26, 2026 01:32
@TheGreatAxios TheGreatAxios changed the title Ship "use client" on stateful components feat: ship "use client" on stateful components Sep 26, 2026
@TheGreatAxios
TheGreatAxios force-pushed the cl-9103-react-ui-ship-use-client-directives-on-stateful-components branch from c5ab71f to b4e2bc2 Compare September 26, 2026 01:37
Component modules that call a hook, create a context, or import a
Radix dialog, dropdown-menu or tooltip, or sonner, start with the
directive; SWC keeps it in dist. dep-guard fails when a component's
directive does not match what it does.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9103-react-ui-ship-use-client-directives-on-stateful-components branch from b4e2bc2 to e6ef9ca Compare September 26, 2026 01:56
@TheGreatAxios
TheGreatAxios added this pull request to stack #74 September 26, 2026 01:57
@TheGreatAxios
TheGreatAxios merged commit 8f9a154 into main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant