-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
fix[devtools/useMemoCache]: add stub for useMemoCache in ReactDebugHook #27472
fix[devtools/useMemoCache]: add stub for useMemoCache in ReactDebugHook #27472
Conversation
I think you are mixing up fiber.updateQueue and hook.updateQueue? |
Oh, probably, but its only for the last point that I've mentioned about |
I don't think the hook object ever has .updateQueue? |
Looks like it. For context, this field was added in #26696. @josephsavona why aren't we using |
Discussed in our sync and the conclusion was that we don't think So for now we'll remove from devtools and then we'll revisit whether we should show higher-level information from Forget in devtools. For example we could in theory show information about which sets of values Forget is memoizing, and what the inputs/ouputs of each of those units are. |
85429c7
to
7dadf27
Compare
7dadf27
to
a5c6ea1
Compare
I've updated this PR accordingly. Now, when user inspects component, which uses Previously, we would list this hook here, because of updating |
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.
nice, thanks for flagging this and for updating!
a5c6ea1
to
1217280
Compare
Update React from from 09fbee89d to a41957507. ### React upstream changes - facebook/react#27472 - facebook/react#27512 - facebook/react#27509 - facebook/react#27517 - facebook/react#27523 - facebook/react#27516 - facebook/react#27505
Changes: * fix[devtools/useMemoCache]: add stub for useMemoCache in ReactDebugHook ([hoxyq](https://github.com/hoxyq) in [#27472](#27472)) * useDeferredValue should skip initialValue if it suspends ([acdlite](https://github.com/acdlite) in [#27509](#27509)) * feat[react-devtools-extensions/logging]: initialize session id on the client for logging ([hoxyq](https://github.com/hoxyq) in [#27517](#27517)) * refactor[react-devtools-extensions]: use globals to eliminate dead code ([hoxyq](https://github.com/hoxyq) in [#27516](#27516)) * fix[devtools/inspectElement]: dont pause initial inspectElement call when user switches tabs ([hoxyq](https://github.com/hoxyq) in [#27488](#27488))
…27659) In #27472 I've removed broken `useMemoCache` implementation and replaced it with a stub. It actually produces errors when trying to inspect components, which are compiled with Forget. The main difference from the implementation in #26696 is that we are using corresponding `Fiber` here, which has patched `updateQueue` with `memoCache`. Previously we would check it on a hook object, which doesn't have `updateQueue`. Tested on pages, which are using Forget and by inspecting elements, which are transpiled with Forget.
…ok (facebook#27472) Currently, we have this error in our logs of the internal version of React DevTools: ``` TypeError: Cannot read properties of undefined (reading 'memoCache') at Proxy.useMemoCache (chrome-extension://dnjnjgbfilfphmojnmhliehogmojhclc/build/react_devtools_backend_compact.js:151:71) ``` Looking at the build files of the extension, it fails here: https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-debug-tools/src/ReactDebugHooks.js#L333-L337 Looks like `updateQueue` can be `undefined`, as it is not defined in hook object here: https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L180-L186 ~~Also, it looks like `useMemoCache` implementation doesn't expect this, so it should also result into TypeError here, line 1114:~~ https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L1108-L1115 ~~Should this also be updated?~~
Changes: * fix[devtools/useMemoCache]: add stub for useMemoCache in ReactDebugHook ([hoxyq](https://github.com/hoxyq) in [facebook#27472](facebook#27472)) * useDeferredValue should skip initialValue if it suspends ([acdlite](https://github.com/acdlite) in [facebook#27509](facebook#27509)) * feat[react-devtools-extensions/logging]: initialize session id on the client for logging ([hoxyq](https://github.com/hoxyq) in [facebook#27517](facebook#27517)) * refactor[react-devtools-extensions]: use globals to eliminate dead code ([hoxyq](https://github.com/hoxyq) in [facebook#27516](facebook#27516)) * fix[devtools/inspectElement]: dont pause initial inspectElement call when user switches tabs ([hoxyq](https://github.com/hoxyq) in [facebook#27488](facebook#27488))
…acebook#27659) In facebook#27472 I've removed broken `useMemoCache` implementation and replaced it with a stub. It actually produces errors when trying to inspect components, which are compiled with Forget. The main difference from the implementation in facebook#26696 is that we are using corresponding `Fiber` here, which has patched `updateQueue` with `memoCache`. Previously we would check it on a hook object, which doesn't have `updateQueue`. Tested on pages, which are using Forget and by inspecting elements, which are transpiled with Forget.
…ok (#27472) Currently, we have this error in our logs of the internal version of React DevTools: ``` TypeError: Cannot read properties of undefined (reading 'memoCache') at Proxy.useMemoCache (chrome-extension://dnjnjgbfilfphmojnmhliehogmojhclc/build/react_devtools_backend_compact.js:151:71) ``` Looking at the build files of the extension, it fails here: https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-debug-tools/src/ReactDebugHooks.js#L333-L337 Looks like `updateQueue` can be `undefined`, as it is not defined in hook object here: https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L180-L186 ~~Also, it looks like `useMemoCache` implementation doesn't expect this, so it should also result into TypeError here, line 1114:~~ https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L1108-L1115 ~~Should this also be updated?~~ DiffTrain build for commit a419575.
Currently, we have this error in our logs of the internal version of React DevTools:
Looking at the build files of the extension, it fails here:
react/packages/react-debug-tools/src/ReactDebugHooks.js
Lines 333 to 337 in dddfe68
Looks like
updateQueue
can beundefined
, as it is not defined in hook object here:react/packages/react-reconciler/src/ReactFiberHooks.js
Lines 180 to 186 in dddfe68
Also, it looks likeuseMemoCache
implementation doesn't expect this, so it should also result into TypeError here, line 1114:react/packages/react-reconciler/src/ReactFiberHooks.js
Lines 1108 to 1115 in dddfe68
Should this also be updated?