diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 506afcedcf36c..050793aa107b6 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -1419,22 +1419,20 @@ export function attach( const boundHasOwnProperty = hasOwnProperty.bind(queue); - // Detect the shape of useState() or useReducer() + // Detect the shape of useState() / useReducer() / useTransition() // using the attributes that are unique to these hooks // but also stable (e.g. not tied to current Lanes implementation) - const isStateOrReducer = - boundHasOwnProperty('pending') && - boundHasOwnProperty('dispatch') && - typeof queue.dispatch === 'function'; + // We don't check for dispatch property, because useTransition doesn't have it + if (boundHasOwnProperty('pending')) { + return true; + } // Detect useSyncExternalStore() - const isSyncExternalStore = + return ( boundHasOwnProperty('value') && boundHasOwnProperty('getSnapshot') && - typeof queue.getSnapshot === 'function'; - - // These are the only types of hooks that can schedule an update. - return isStateOrReducer || isSyncExternalStore; + typeof queue.getSnapshot === 'function' + ); } function didStatefulHookChange(prev: any, next: any): boolean {