Skip to content

feat(browser-react): add React 17 entry via @rstest/browser-react/react17#1239

Closed
fi3ework wants to merge 1 commit into
mainfrom
feat/browser-react-17
Closed

feat(browser-react): add React 17 entry via @rstest/browser-react/react17#1239
fi3ework wants to merge 1 commit into
mainfrom
feat/browser-react-17

Conversation

@fi3ework

Copy link
Copy Markdown
Member

Summary

Background

@rstest/browser-react statically imports react-dom/client, which does not exist under React 17. React 17 users hit a hard resolution error today and have no workable entry point.

Implementation

  • Extract a shared createRenderApi factory so render / renderHook / cleanup are reused across React majors.
  • Add new entries @rstest/browser-react/react17 (auto-cleanup) and @rstest/browser-react/react17/pure, mounting via ReactDOM.render / unmountComponentAtNode and pulling act from react-dom/test-utils.
  • Detect React.unstable_act so the default entry also keeps working under React 18.0–18.2.

User Impact

React 17 projects can now use @rstest/browser-react/react17 without bundler configuration. React 18+ users are unaffected (default entry is unchanged).

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

…act17`

- Extract a shared `createRenderApi` factory so render/renderHook/cleanup logic is reused across React majors.
- Add `./react17` and `./react17/pure` entries that mount via `ReactDOM.render` / `unmountComponentAtNode` and use `act` from `react-dom/test-utils`.
- Fall back to `React.unstable_act` for React 18.0–18.2.
- Cover the new entry with an e2e fixture pinned to React 17.
@github-actions

Copy link
Copy Markdown

Rsdoctor Bundle Diff Analysis

Found 12 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
adapter-rsbuild 3.6 KB 0
adapter-rslib 24.6 KB 0
adapter-rspack 7.7 KB 0
browser 2.0 MB 0
browser-react 5.1 KB 📈 +1.4 KB (+39.0%)
browser-ui 803.5 KB 0
coverage-istanbul 9.6 KB 0
core/browser 970.2 KB 0
core/loaders 869.0 B 0
core/main 1.6 MB 0
vscode/extension 58.9 MB 0
vscode/worker 14.4 KB 0
📋 Detailed Reports (Click to expand)

📁 browser-react

Path: packages/browser-react/.rsdoctor/rsdoctor-data.json

📌 Baseline Commit: 5034f79d55 | PR: #1238

Metric Current Baseline Change
📊 Total Size 5.1 KB 3.7 KB +1.4 KB (+39.0%)
📄 JavaScript 5.1 KB 3.7 KB +1.4 KB (+39.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: browser-react Bundle Diff

Generated by Rsdoctor GitHub Action

@fi3ework fi3ework marked this pull request as draft May 11, 2026 11:35
@fi3ework

Copy link
Copy Markdown
Member Author

close until we decide to do it in the future.

@fi3ework fi3ework closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant