apollo-client icon indicating copy to clipboard operation
apollo-client copied to clipboard

Nullish check devtools.enabled

Open mgmolisani opened this issue 1 year ago • 4 comments

Dev tools has a new syntax and deprecated the old connectToDevTools. However, the deprecation was implemented with || connectToDevTools instead of ?? connectToDevTools which results in devtools?.enabled to be overwritten by connectToDevTools for any falsy value. If connectToDevTools ends up being undefined, it overwrites false which then passes the guard on the next line erroneously and replaces the flag with __DEV__.

In our environment this transpiles down to globalThis.__DEV__ !== false and globalThis.__DEV__ is undefined so this effectively forces dev tools on even though we had devtools.enabled = false

mgmolisani avatar Oct 10 '24 16:10 mgmolisani

@mgmolisani: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

apollo-cla avatar Oct 10 '24 16:10 apollo-cla

Deploy request for apollo-client-docs pending review.

Visit the deploys page to approve it

Name Link
Latest commit b7d000d794d2f1444c45cb65dd81c0c3458e7eef

netlify[bot] avatar Oct 10 '24 16:10 netlify[bot]

✅ Docs Preview Ready

No new or changed pages found.

svc-apollo-docs avatar Oct 10 '24 16:10 svc-apollo-docs

🦋 Changeset detected

Latest commit: b7d000d794d2f1444c45cb65dd81c0c3458e7eef

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

This PR includes changesets to release 1 package
Name Type
@apollo/client 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

changeset-bot[bot] avatar Oct 10 '24 16:10 changeset-bot[bot]

Hey @mgmolisani 👋

Good catch! Would you mind adding a changeset to this PR? I'd be happy to merge and deploy this once that is in place.

jerelmiller avatar Oct 23 '24 21:10 jerelmiller

Added changeset

mgmolisani avatar Nov 11 '24 15:11 mgmolisani

npm i https://pkg.pr.new/@apollo/client@12093

commit: e8251d6

pkg-pr-new[bot] avatar Nov 11 '24 17:11 pkg-pr-new[bot]