Skip to content

fix(ui-components): move react from dependencies to peer and dev deps - #9176

Open
alexicum wants to merge 1 commit into
nodejs:mainfrom
alexicum:fix/ui-components-peer-react
Open

alexicum wants to merge 1 commit into
nodejs:mainfrom
alexicum:fix/ui-components-peer-react

Conversation

@alexicum

Copy link
Copy Markdown

Context

The ui-components package had react listed under dependencies. When published, this metadata structure forces consumer applications running a different sub-version of React 19 to install a duplicate instance of React, triggering runtime Invalid hook call errors.

Changes

To resolve external runtime duplication while preserving strict React 19 compatibility and seamless local workspace development, this PR applies the following:

  1. Moved react to peerDependencies in packages/ui-components/package.json using the catalog:peer-react19 protocol to delegate runtime React resolution to the host/consumer application.
  2. Duplicated react in devDependencies to guarantee that local package builds (pnpm build), test utilities, and TypeScript types compilation inside the isolated package directory do not break.
  3. Aligned pnpm Catalogs (pnpm-workspace.yaml): Configured catalog:peer-react19 to target a loose ^19.0.0 range. When the library is published, pnpm will substitute the catalog protocol with a standard open SemVer range (^19.0.0) matching any consumer's native React 19 installation.
  4. Added a Changeset: Generated a patch bump changeset (.changeset/cozy-teeth-speak.md) to comply with the workspace publishing policy.

Fixes #9175

@alexicum
alexicum requested review from a team as code owners September 25, 2026 17:43
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Sep 30, 2026 6:47am UTC

Request Review

…ndencies

Signed-off-by: Aleksey Shestakov <alshestakov25@gmail.com>
@ovflowd

ovflowd commented Oct 4, 2026

Copy link
Copy Markdown
Member

@avivkeller wdyt about this? Does it make sense?

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (842e9ae) to head (9301469).
⚠️ Report is 19 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9176      +/-   ##
==========================================
- Coverage   86.12%   86.11%   -0.02%     
==========================================
  Files          86       86              
  Lines        6041     6041              
  Branches      357      357              
==========================================
- Hits         5203     5202       -1     
- Misses        834      835       +1     
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total First Load JS 7.10 MB
New Total First Load JS 7.10 MB
Delta 0 B (0.00%)

This branch had an error being deployed

1 failed and 1 active deployments
Storybook — 93014694 Deployed Oct 4, 2026 by alexicum via Chromatic #2227
Preview — 93014694 Deployed Sep 30, 2026 by vercel[bot]
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.

fix(ui-components): react in regular dependencies causes duplicate hook errors in consumer apps

2 participants