diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index d2cea81f576c4..2e1fcb19a6782 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -731,6 +731,24 @@ function useHostTransitionStatus(): TransitionStatus { return status; } +function useResourceEffect( + create: () => mixed, + createDeps: Array | void | null, + update: ((resource: mixed) => void) | void, + updateDeps: Array | void | null, + destroy: ((resource: mixed) => void) | void, +) { + nextHook(); + hookLog.push({ + displayName: null, + primitive: 'ResourceEffect', + stackError: new Error(), + value: create, + debugInfo: null, + dispatcherHookName: 'ResourceEffect', + }); +} + const Dispatcher: DispatcherType = { use, readContext, @@ -755,6 +773,7 @@ const Dispatcher: DispatcherType = { useFormState, useActionState, useHostTransitionStatus, + useResourceEffect, }; // create a proxy to throw a custom error @@ -943,6 +962,10 @@ function parseHookName(functionName: void | string): string { startIndex += 'unstable_'.length; } + if (functionName.slice(startIndex).startsWith('unstable_')) { + startIndex += 'experimental_'.length; + } + if (functionName.slice(startIndex, startIndex + 3) === 'use') { if (functionName.length - startIndex === 3) { return 'Use';