Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/react-reconciler/src/ReactFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,10 @@ function createFiberFromProfiler(
): Fiber {
if (__DEV__) {
if (typeof pendingProps.id !== 'string') {
console.error('Profiler must specify an "id" as a prop');
console.error(
'Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',
typeof pendingProps.id,
);
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/react-reconciler/src/ReactFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,10 @@ function createFiberFromProfiler(
): Fiber {
if (__DEV__) {
if (typeof pendingProps.id !== 'string') {
console.error('Profiler must specify an "id" as a prop');
console.error(
'Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',
typeof pendingProps.id,
);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/react/src/__tests__/ReactProfiler-test.internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ describe('Profiler', () => {
it('should warn if required params are missing', () => {
expect(() => {
ReactTestRenderer.create(<React.Profiler />);
}).toErrorDev('Profiler must specify an "id" as a prop', {
withoutStack: true,
});
}).toErrorDev(
'Profiler must specify an "id" of type `string` as a prop. Received the type `undefined` instead.',
{
withoutStack: true,
},
);
});
}

Expand Down