Skip to content

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

Description

@alexicum

Description

Currently, react is listed under dependencies in packages/ui-components/package.json.

While it works fine inside the monorepo, it breaks consumer apps that use a different sub-version of React 19. Package managers install a duplicate copy of React , leading to the runtime error:

Invalid hook call. You might have more than one copy of React in the same app.

Proposed Solution

Move react from dependencies to peerDependencies (and duplicate in devDependencies for local workspace builds).

We should use a named pnpm catalog (catalog:peer-react19 with a ^19.0.0 range) so the published package accepts any React 19 version installed by the consumer app.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions