fix(browser-react): drop React 17 from peer deps#1240
Merged
Conversation
Rsdoctor Bundle Diff AnalysisFound 12 projects in monorepo, 1 project with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 browser-reactPath:
📦 Download Diff Report: browser-react Bundle Diff Generated by Rsdoctor GitHub Action |
React 17 is not actually supported: `@rstest/browser-react` statically imports `react-dom/client`, which does not exist under React 17 and fails to resolve at install/build time. - Narrow peer deps to `^18.0.0 || ^19.0.0` so npm/pnpm warn React 17 users at install time instead of failing later at runtime. - Update README compatibility section and drop the stale React 17 fallback note from the `act()` docs. - Extend the `_act` detection to fall back to `React.unstable_act`, so React 18.0.0 – 18.3.0 (which only expose `unstable_act`) actually get a working `act` instead of a no-op.
cabc8ec to
cdee1f6
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Background
@rstest/browser-reactstatically importsreact-dom/client, which does not exist under React 17, so React 17 users hit a hard resolution error at install/build time. The peer dep range, README, andact()docs were still advertising React 17 as supported, which is misleading. This PR makes the supported range honest after deciding not to land #1239 (which added a separate React 17 entry).Implementation
^18.0.0 || ^19.0.0inpackages/browser-react/package.json.React >= 18and drop the stale React 17 fallback note from theact()docs._actdetection insrc/act.tsto fall back toReact.unstable_act, so React 18.0.0 – 18.3.0 (which only exposeunstable_act) get a workingactinstead of a no-op.AGENTS.mdguidance with the precise version boundaries (verified against publishedreact/cjs/*.jsbundles):React.actwas only stabilized in 18.3.1, and React 17 has neitheractnorunstable_act.User Impact
React 17 users now get a clear peer-dep warning at install time instead of a confusing
react-dom/clientresolution failure. React 18.0.0 – 18.3.0 users get correctactbatching behavior instead of a silent no-op fallback. React 18.3.1+/19 users are unaffected.Related Links
@rstest/browser-react/react17#1239 (separate React 17 entry approach was abandoned).actstabilization: react/react@f1338f80 (landed in 18.3.1).Validation
Local: `pnpm run lint` ✓, `pnpm --filter @rstest/browser-react typecheck` ✓, `pnpm --filter @rstest/browser-react build` ✓.
Skipped locally (pre-existing failures on `origin/main`, unrelated to this PR — verified by re-running with the working tree stashed):
CI will run the full suite.
Checklist