File tree Expand file tree Collapse file tree 1 file changed +6
-23
lines changed
packages/react-devtools-shared/src/backend/fiber Expand file tree Collapse file tree 1 file changed +6
-23
lines changed Original file line number Diff line number Diff line change @@ -2028,20 +2028,6 @@ export function attach(
20282028 return false;
20292029 }
20302030
2031- function isUseSyncExternalStoreHook(hookObject: any): boolean {
2032- const queue = hookObject.queue;
2033- if (!queue) {
2034- return false;
2035- }
2036-
2037- const boundHasOwnProperty = hasOwnProperty.bind(queue);
2038- return (
2039- boundHasOwnProperty('value') &&
2040- boundHasOwnProperty('getSnapshot') &&
2041- typeof queue.getSnapshot === 'function'
2042- );
2043- }
2044-
20452031 function isHookThatCanScheduleUpdate(hookObject: any) {
20462032 const queue = hookObject.queue;
20472033 if (!queue) {
@@ -2058,7 +2044,12 @@ export function attach(
20582044 return true;
20592045 }
20602046
2061- return isUseSyncExternalStoreHook(hookObject);
2047+ // Detect useSyncExternalStore()
2048+ return (
2049+ boundHasOwnProperty('value') &&
2050+ boundHasOwnProperty('getSnapshot') &&
2051+ typeof queue.getSnapshot === 'function'
2052+ );
20622053 }
20632054
20642055 function didStatefulHookChange(prev: any, next: any): boolean {
@@ -2079,18 +2070,10 @@ export function attach(
20792070
20802071 const indices = [];
20812072 let index = 0;
2082-
20832073 while (next !== null) {
20842074 if (didStatefulHookChange(prev, next)) {
20852075 indices.push(index);
20862076 }
2087-
2088- // useSyncExternalStore creates 2 internal hooks, but we only count it as 1 user-facing hook
2089- if (isUseSyncExternalStoreHook(next)) {
2090- next = next.next;
2091- prev = prev.next;
2092- }
2093-
20942077 next = next.next;
20952078 prev = prev.next;
20962079 index++;
You can’t perform that action at this time.
0 commit comments