Skip to content

Commit 78e8d9e

Browse files
authored
start testing with React 19 (#11883)
* start testing with React 19 --------- Co-authored-by: phryneas <[email protected]>
1 parent d04bdea commit 78e8d9e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/testing/internal/profile/profile.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,20 @@ export function profileHook<ReturnValue extends ValidSnapshot, Props>(
434434
);
435435
}
436436

437-
function resolveHookOwner(): React.ComponentType | undefined {
437+
function resolveR18HookOwner(): React.ComponentType | undefined {
438438
return (React as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
439439
?.ReactCurrentOwner?.current?.elementType;
440440
}
441441

442+
function resolveR19HookOwner(): React.ComponentType | undefined {
443+
return (
444+
React as any
445+
).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.A?.getOwner()
446+
.elementType;
447+
}
448+
442449
export function useTrackRenders({ name }: { name?: string } = {}) {
443-
const component = name || resolveHookOwner();
450+
const component = name || resolveR18HookOwner() || resolveR19HookOwner();
444451

445452
if (!component) {
446453
throw new Error(

0 commit comments

Comments
 (0)