File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
packages/react-devtools-shared/src/backend Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1419,22 +1419,20 @@ export function attach(
1419
1419
1420
1420
const boundHasOwnProperty = hasOwnProperty . bind ( queue ) ;
1421
1421
1422
- // Detect the shape of useState() or useReducer()
1422
+ // Detect the shape of useState() / useReducer() / useTransition ()
1423
1423
// using the attributes that are unique to these hooks
1424
1424
// but also stable (e.g. not tied to current Lanes implementation)
1425
- const isStateOrReducer =
1426
- boundHasOwnProperty ( 'pending' ) &&
1427
- boundHasOwnProperty ( 'dispatch' ) &&
1428
- typeof queue . dispatch === 'function' ;
1425
+ // We don't check for dispatch property, because useTransition doesn't have it
1426
+ if ( boundHasOwnProperty ( 'pending' ) ) {
1427
+ return true ;
1428
+ }
1429
1429
1430
1430
// Detect useSyncExternalStore()
1431
- const isSyncExternalStore =
1431
+ return (
1432
1432
boundHasOwnProperty('value') &&
1433
1433
boundHasOwnProperty ( 'getSnapshot ') &&
1434
- typeof queue . getSnapshot === 'function' ;
1435
-
1436
- // These are the only types of hooks that can schedule an update.
1437
- return isStateOrReducer || isSyncExternalStore ;
1434
+ typeof queue . getSnapshot === 'function '
1435
+ ) ;
1438
1436
}
1439
1437
1440
1438
function didStatefulHookChange ( prev : any , next : any ) : boolean {
You can’t perform that action at this time.
0 commit comments