Skip to content

React 19 Cannot update a component (Component) while rendering a different component #3764

@JoaoBGusmao

Description

@JoaoBGusmao

Describe the bug

Since react 19, there is an error showing up when trying to mount a component that runs a query that was already executed by another component.

I found this error while updating a website to next15. It has a page that calls a follow button that queries the followage status. The error shows up when navigating to a different page that imports the same button component.

I prepared two examples, one using nextjs, which is closer to my use case, and another one using npx create-react-router@latest.

What I found out is that the error only happens when using network-only, and when the two query invocation has the same query name. (There's an extra page on next's example that test it). On nextjs, it happens regardless using network-only or not

create-react-router example:
https://github.com/JoaoBGusmao/urql-r19-bug

nextjs example:
https://github.com/JoaoBGusmao/urql-next15-bug

Both projects, just install the dependencies and run yarn dev

Reproduction

https://github.com/JoaoBGusmao/urql-r19-bug

Urql version

urql 4.2.2

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions