chore: update react to 19 and fix strict mode tests - #89
chore: update react to 19 and fix strict mode tests#89Wendy Fouchter (Wendystraite) wants to merge 1 commit into
Conversation
|
There was a problem hiding this comment.
Pull Request Overview
Updates React from version 18 to 19 and adjusts test expectations to account for React 19's improved strict mode behavior, where useMemo and useCallback now reuse memoized results from the first render during the second render.
- Updated React and related dependencies from version 18 to 19
- Modified test expectations to reflect React 19's strict mode improvements where useMemo prevents duplicate executions
- Added sanity tests to document and verify the new React 19 strict mode behavior
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Updated React dependencies from v18 to v19 and removed obsolete packages |
| src/react/useMolecule.test.tsx | Adjusted execution count expectations in strict mode tests from 2 to 1 due to useMemo improvements |
| src/react/ScopeProvider.test.tsx | Simplified strict mode test assertions to match new behavior where execution counts are consistent |
| src/react/sanity.test.tsx | Added new tests documenting React 19's useMemo and useCallback behavior in strict mode |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Wendy Fouchter (@Wendystraite) please update your PR on top of main to resolve merge conflicts. |
Update React from 18 to 19. Strict mode tests broke due to how strict mode changed in React 19 : useMemo and useCallback reuse the memoized results from the first render during the second render and since `useMolecule` calls `useLazily` inside a React `useMemo`, it prevents some unwanted executions.
bebc430 to
0bee047
Compare
|
Logan Volkers (@loganvolkers) all my PRs have been rebased. |
Description of the change
Update React from 18 to 19.
Strict mode tests broke due to how strict mode changed in React 19 : useMemo and useCallback reuse the memoized results from the first render during the second render and since
useMoleculecallsuseLazilyinside a ReactuseMemo, it prevents some unwanted executions.See https://react.dev/blog/2024/04/25/react-19-upgrade-guide#strict-mode-improvements
Type of change