Skip to content

chore: make react-dom and react-native optional peer dependencies#9295

Open
Gudahtt wants to merge 3 commits into
mainfrom
react-data-query-optional-peer-deps
Open

chore: make react-dom and react-native optional peer dependencies#9295
Gudahtt wants to merge 3 commits into
mainfrom
react-data-query-optional-peer-deps

Conversation

@Gudahtt

@Gudahtt Gudahtt commented Jun 27, 2026

Copy link
Copy Markdown
Member

Explanation

The package @metamask/react-data-query has react-dom and react-native as peerDependencies because they are peer dependencies of a dependency this package uses, @tanstack/react-query. This "forwarding" of peer dependencies is something we started doing in our own packages because it better highlights the legitimate requirements of the package (transitive peer dependencies tend to not get surfaced by package managers when they're not met, you have to dig for it).

However, @tanstack/react-query has these two peer dependencies as optional, as they should be. We forgot to document them as optional.

This resolves an unnecessary peer dependency warning in metamask-extension.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Packaging and tooling metadata only; no application or library runtime logic changes.

Overview
@metamask/react-data-query now marks react-dom and react-native as optional peer dependencies via peerDependenciesMeta, matching how @tanstack/react-query treats them and stopping spurious peer warnings in consumers like metamask-extension.

The unreleased changelog documents the change, yarn.lock reflects the updated workspace package metadata, and knip.config.ts adds a packages/react-data-query ignoreDependencies entry for those two packages (linked to a known knip issue) so they are not reported as unused when they only exist as forwarded peers.

Reviewed by Cursor Bugbot for commit 5e323b3. Bugbot is set up for automated code reviews on this repo. Configure here.

Gudahtt added 2 commits June 26, 2026 22:45
The package `@metamask/react-data-query` has `react-dom` and
`react-native` as `peerDependencies` because they are peer dependencies
of a dependency this package uses, `@tanstack/react-query`. This
"forwarding" of peer dependencies is something we started doing in our
own packages because it better highlights the legitimate requirements
of the package (transitive peer dependencies tend to not get surfaced
by package managers when they're not met, you have to dig for it).

However, `@tanstack/react-query` has these two peer dependencies as
_optional_, as they should be. We forgot to document them as optional.

This resolves an unnecessary peer dependency warning in
`metamask-extension`.
@Gudahtt Gudahtt marked this pull request as ready for review June 27, 2026 01:20
@Gudahtt Gudahtt requested a review from a team as a code owner June 27, 2026 01:20
@Gudahtt Gudahtt deployed to default-branch June 27, 2026 01:20 — with GitHub Actions Active
@Gudahtt Gudahtt force-pushed the react-data-query-optional-peer-deps branch from 1cf5a55 to 5e323b3 Compare June 27, 2026 02:34
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