Skip to content

Conversation

amannn
Copy link

@amannn amannn commented Aug 27, 2025

Summary

This adds a failing test for #3764.

I also had to upgrade React to v19 for the test to fail as expected:

This error originated in "src/hooks/useQuery.cross-component-warning.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
The latest test that might've caused the error is "does not warn when the same query is used in parent and child". It might mean one of the following:
- The error was thrown, while Vitest was running this test.
- If the error occurred after the test had been completed, this was the last documented test before it was thrown.
Caused by: Error: Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://react.dev/link/setstate-in-render
 ❯ Object.globalThis.console.error.vi.SpyInstance ../../scripts/vitest/setup.js:16:11
 ❯ Object.mockCall ../../node_modules/.pnpm/@[email protected]/node_modules/@vitest/spy/dist/index.js:61:17
 ❯ Object.spy [as error] ../../node_modules/.pnpm/[email protected]/node_modules/tinyspy/dist/index.js:45:80
 ❯ scheduleUpdateOnFiber ../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-client.development.js:14380:25
 ❯ dispatchSetStateInternal ../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-client.development.js:6969:13
 ❯ dispatchSetState ../../node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/cjs/react-dom-client.development.js:6927:7
 ❯ Module.deferDispatch src/hooks/state.ts:83:5
 ❯ updateResult src/hooks/useQuery.ts:336:7
 ❯ ../../node_modules/.pnpm/[email protected]/node_modules/wonka/dist/wonka.mjs:1064:9
 ❯ ../../node_modules/.pnpm/[email protected]/node_modules/wonka/dist/wonka.mjs:295:9

(the relevant part is the "Cannot update a component …")

There's however more work necessary for the React 19 upgrade (other tests are failing due to the deprecated test renderer). Maybe you want to do the React 19 upgrade in another PR?

I hope this can be used for #3769 to verify the the bug is fixed.

Set of changes

  • Add failing test
  • Upgrade to React 19 (partially)

Copy link

changeset-bot bot commented Aug 27, 2025

⚠️ No Changeset found

Latest commit: 120805b

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

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.

3 participants