Skip to content

Commit

Permalink
Add context for non null prototype error
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Jul 9, 2024
1 parent 274c980 commit d59ac56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/react-client/src/__tests__/ReactFlight-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,10 @@ describe('ReactFlight', () => {

expect(errors).toEqual([
'Only plain objects, and a few built-ins, can be passed to Client Components ' +
'from Server Components. Classes or null prototypes are not supported.',
'from Server Components. Classes or null prototypes are not supported.' +
(__DEV__
? '\n' + ' <input value={{}}>\n' + ' ^^^^'
: '\n' + ' {value: {}}\n' + ' ^^'),
]);
});

Expand Down
3 changes: 2 additions & 1 deletion packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,8 @@ function renderModelDestructive(
) {
throw new Error(
'Only plain objects, and a few built-ins, can be passed to Client Components ' +
'from Server Components. Classes or null prototypes are not supported.',
'from Server Components. Classes or null prototypes are not supported.' +
describeObjectForErrorMessage(parent, parentPropertyName),
);
}
if (__DEV__) {
Expand Down

0 comments on commit d59ac56

Please sign in to comment.