Skip to content

chore: update react to 19 and fix strict mode tests - #89

Open
Wendy Fouchter (Wendystraite) wants to merge 1 commit into
saasquatch:mainfrom
Wendystraite:update_react_19
Open

chore: update react to 19 and fix strict mode tests#89
Wendy Fouchter (Wendystraite) wants to merge 1 commit into
saasquatch:mainfrom
Wendystraite:update_react_19

Conversation

@Wendystraite

@Wendystraite Wendy Fouchter (Wendystraite) commented Oct 4, 2025

Copy link
Copy Markdown
Contributor

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 useMolecule calls useLazily inside a React useMemo, it prevents some unwanted executions.

See https://react.dev/blog/2024/04/25/react-19-upgrade-guide#strict-mode-improvements

React 19 includes several fixes and improvements to Strict Mode.

When double rendering in Strict Mode in development, useMemo and useCallback will reuse the memoized results from the first render during the second render. Components that are already Strict Mode compatible should not notice a difference in behavior.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation or Development tools (readme, specs, tests, code formatting)

Copilot AI review requested due to automatic review settings October 4, 2025 14:15
@changeset-bot

changeset-bot Bot commented Oct 4, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0bee047

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@loganvolkers

Copy link
Copy Markdown
Member

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.
@Wendystraite

Copy link
Copy Markdown
Contributor Author

Logan Volkers (@loganvolkers) all my PRs have been rebased.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants