GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix[react-devtools/ReactDebugHooks]: support unstable prefixes in hooks and useContextWithBailout by hoxyq · Pull Request #30837 · react/react

Conversation

@hoxyq

@hoxyq hoxyq commented Aug 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Related - #30407.

This is experimental-only and FB-only hook. Without these changes, inspecting an element that is using this hook will throw an error, because this hook is missing in Dispatcher implementation from React DevTools, which overrides the original one to build the hook tree.

Screenshot 2024-08-28 at 18 42 55

One nice thing from it is that in case of any potential regressions related to this experiment, we can quickly triage which implementation of useContext is used by inspecting an element in React DevTools.

Ideally, I should've added some component that is using this hook to react-devtools-shell, so it can be manually tested, but I can't do it without rewriting the infra for it. This is because this hook is only available from fb-www builds, and not experimental.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hoxyq
hoxyq requested review from eps1lon and jackpope August 28, 2024 17:49
@facebook-github-bot facebook-github-bot added the CLA Signed label Aug 28, 2024
@vercel

vercel Bot commented Aug 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 8:07pm
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Aug 28, 2024
@react-sizebot

react-sizebot commented Aug 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 7771d3a7972cc2483c45fde51b7ec2d926cba097...367d517612ac7a85285b36ff7f21523f567ee1f4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 501.40 kB 501.40 kB = 89.99 kB 89.99 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 508.52 kB 508.52 kB = 91.16 kB 91.16 kB
facebook-www/ReactDOM-prod.classic.js = 596.16 kB 596.16 kB = 105.70 kB 105.70 kB
facebook-www/ReactDOM-prod.modern.js = 572.44 kB 572.44 kB = 101.88 kB 101.88 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable-rc/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js +2.23% 31.65 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable-rc/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable-rc/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.js +2.25% 28.24 kB 28.88 kB +1.52% 5.59 kB 5.67 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js +2.23% 31.65 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable-rc/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js +2.21% 31.66 kB 32.36 kB +1.40% 5.72 kB 5.80 kB

Generated by 🚫 dangerJS against 433fc09

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hoxyq
hoxyq force-pushed the react-devtools/support-use-context-with-bailout-and-unstable-prefix branch from d63e49f to 37c6cc7 Compare August 28, 2024 17:53
@vercel
vercel Bot deployed to Preview August 28, 2024 18:04
View deployment
@hoxyq
fix[react-devtools/ReactDebugHooks]: support unstable prefixes in hoo…
433fc09
…ks and useContextWithBailout
@hoxyq
hoxyq force-pushed the react-devtools/support-use-context-with-bailout-and-unstable-prefix branch from 37c6cc7 to 433fc09 Compare August 28, 2024 20:05
@vercel
vercel Bot deployed to Preview August 28, 2024 20:07
View deployment
eps1lon
eps1lon approved these changes Aug 29, 2024
View reviewed changes
Comment thread packages/react-debug-tools/src/ReactDebugHooks.js
Comment on lines +982 to +984
if (functionName.slice(startIndex).startsWith('unstable_')) {
startIndex += 'unstable_'.length;
}

@eps1lon eps1lon Aug 29, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I never considered that. I guess we also have a similar problem with experimental_useEffectEvent.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hoxyq reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@hoxyq hoxyq Aug 29, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@jackpope @gsathya Do we have plans for using experimental_useEffectEvent soon? Will it be transpiled by the compiler?

I can put up a separate PR for it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jackpope jackpope Aug 29, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Not that I know of. But it might be worth handling the pattern anyway. I think we can assume we'll create more unstable_ or experimental_ prefixes in the future, beyond useEffectEvent / useContextWithBailout.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jackpope
jackpope approved these changes Aug 29, 2024
View reviewed changes
@hoxyq
hoxyq merged commit 8308d2f into react:main Aug 30, 2024
@hoxyq
hoxyq deleted the react-devtools/support-use-context-with-bailout-and-unstable-prefix branch August 30, 2024 09:34
This was referenced Aug 30, 2024
Upgrade React from 7771d3a7-20240827 to e56f4ae3-20240830 vercel/next.js#69500
Closed
Upgrade React from 7771d3a7-20240827 to 4f604941-20240830 vercel/next.js#69578
Closed
Upgrade React from 7771d3a7-20240827 to d1afcb43-20240903 vercel/next.js#69687
Closed
Upgrade React from 7771d3a7-20240827 to 4c58fce7-20240904 vercel/next.js#69743
Closed
This was referenced Sep 6, 2024
Upgrade React from 7771d3a7-20240827 to a03254bc-20240905 vercel/next.js#69794
Closed
Upgrade React from 7771d3a7-20240827 to e210d081-20240909 vercel/next.js#69885
Closed
Upgrade React from 7771d3a7-20240827 to 3dfd5d9e-20240910 vercel/next.js#69928
Closed
Upgrade React from 7771d3a7-20240827 to d6cb4e77-20240911 vercel/next.js#69980
Closed
Upgrade React from 7771d3a7-20240827 to 47352209-20240912 vercel/next.js#70035
Closed
Upgrade React from 7771d3a7-20240827 to 94e652d5-20240912 vercel/next.js#70037
Merged
gnoff pushed a commit to vercel/next.js that referenced this pull request Sep 12, 2024
@vercel-release-bot
Upgrade React from 7771d3a7-20240827 to 94e652d5-20240912 (#70037)
f2cf2e0
**breaking change for canary users: Bumps peer dependency of React from
`19.0.0-rc-7771d3a7-20240827` to `19.0.0-rc-94e652d5-20240912`**

[diff
react/react@7771d3a7...94e652d5](react/react@7771d3a...94e652d)

<details>
<summary>React upstream changes</summary>

- react/react#30952
- react/react#30950
- react/react#30946
- react/react#30934
- react/react#30947
- react/react#30945
- react/react#30938
- react/react#30936
- react/react#30879
- react/react#30888
- react/react#30931
- react/react#30930
- react/react#30832
- react/react#30929
- react/react#30926
- react/react#30925
- react/react#30905
- react/react#30900
- react/react#30910
- react/react#30906
- react/react#30899
- react/react#30919
- react/react#30708
- react/react#30907
- react/react#30897
- react/react#30896
- react/react#30895
- react/react#30887
- react/react#30889
- react/react#30893
- react/react#30892
- react/react#30891
- react/react#30882
- react/react#30881
- react/react#30870
- react/react#30849
- react/react#30878
- react/react#30865
- react/react#30869
- react/react#30875
- react/react#30800
- react/react#30762
- react/react#30831
- react/react#30866
- react/react#30853
- react/react#30850
- react/react#30847
- react/react#30842
- react/react#30837
- react/react#30848
- react/react#30844
- react/react#30839
- react/react#30802
- react/react#30841
- react/react#30827
- react/react#30826
- react/react#30825
- react/react#30824
- react/react#30840
- react/react#30838
- react/react#30836
- react/react#30819
- react/react#30816
- react/react#30814
- react/react#30813
- react/react#30812
- react/react#30811

</details>

---------

Co-authored-by: vercel-release-bot <[email protected]>
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@hoxyq
fix[react-devtools/ReactDebugHooks]: support unstable prefixes in hoo…
cb90505
…ks and useContextWithBailout (react#30837)

Related - react#30407.

This is experimental-only and FB-only hook. Without these changes,
inspecting an element that is using this hook will throw an error,
because this hook is missing in Dispatcher implementation from React
DevTools, which overrides the original one to build the hook tree.

![Screenshot 2024-08-28 at 18 42
55](https://github.com/user-attachments/assets/e3bccb92-74fb-4e4a-8181-03d13f8512c0)

One nice thing from it is that in case of any potential regressions
related to this experiment, we can quickly triage which implementation
of `useContext` is used by inspecting an element in React DevTools.

Ideally, I should've added some component that is using this hook to
`react-devtools-shell`, so it can be manually tested, but I can't do it
without rewriting the infra for it. This is because this hook is only
available from fb-www builds, and not experimental.

This branch was successfully deployed

1 active deployment
Preview — 433fc09d Deployed Aug 28, 2024 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jackpope jackpope jackpope approved these changes
@eps1lon eps1lon eps1lon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@hoxyq @react-sizebot @jackpope @eps1lon @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.