Skip to content

fix(react-urql): Upgrade muted warning code for React 19 internals #3769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kitten
Copy link
Member

@kitten kitten commented Apr 1, 2025

Resolves #3764

Summary

Same as before: the warning is irrelevant, and we're looking to mute it. We can make the deferred dispatching permanent, if we don't want to rely on internals, but this PR currently keeps it the same and just updates how we access internals.

These lines show how this internal has changed: https://github.com/facebook/react/blob/b286430c8a585dc2e2e3cc023e7c455ec2b34ab7/packages/react/src/jsx/ReactJSXElement.js#L52-L61

As before, just because the warning is issued that doesn't mean anything is wrong. We're only doing this to mute this warning.

Warning

I haven't tested this yet, at all, but it should work fine.

Set of changes

  • Update how ReactCurrentOwner is accessed using new internals

@kitten kitten requested a review from JoviDeCroock April 1, 2025 09:45
Copy link

changeset-bot bot commented Apr 1, 2025

🦋 Changeset detected

Latest commit: 4ddd5d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
urql Patch

Not sure what this means? Click here to learn what changesets are.

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

@kitten kitten changed the title @kitten/fix/react 19 mute warning fix(react-urql): Upgrade muted warning code for React 19 internals Apr 1, 2025
@ericpoulinnz
Copy link

@kitten any timeline for when this PR will get merged and released? With Expo 53 being released this week there will be a lot of projects now on React 19 and getting this error.

@sep2
Copy link

sep2 commented May 14, 2025

We use this pnpm patch to appy this PR before it merged

diff --git a/dist/urql.es.js b/dist/urql.es.js
index c2ef1c7e614e49bad3002c98893ccbc5ed2abc5b..0b5feec9a4631e3827389803d687b573b21c26a5 100644
--- a/dist/urql.es.js
+++ b/dist/urql.es.js
@@ -70,11 +70,21 @@ var hasDepsChanged = (e, r) => {
   return !1;
 };
 
-var p = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+
+var p = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED || r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
 
 function deferDispatch(e, r) {
-  if ("production" !== process.env.NODE_ENV && p && p.ReactCurrentOwner && p.ReactCurrentOwner.current) {
-    Promise.resolve(r).then(e);
+  if (!!p && process.env.NODE_ENV !== 'production') {
+    const currentOwner = p.ReactCurrentOwner
+      ? p.ReactCurrentOwner.current
+      : p.A &&
+      p.A.getOwner &&
+      p.A.getOwner();
+    if (currentOwner) {
+      Promise.resolve(r).then(e);
+    } else {
+      e(r);
+    }
   } else {
     e(r);
   }

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.

React 19 Cannot update a component (Component) while rendering a different component
4 participants