Skip to content
Open
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
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberThenable.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ export function trackUsedThenable<T>(
// granular warnings.
thenableStateDev.didWarnAboutUncachedPromise = true;

// TODO: This warning should link to a corresponding docs page.
console.error(
'A component was suspended by an uncached promise. Creating ' +
'promises inside a Client Component or hook is not yet ' +
'supported, except via a Suspense-compatible library or framework.',
'supported, except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use',
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3574,6 +3574,7 @@ describe('ReactSuspenseList', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Foo (at **)',
]);
});
Expand Down Expand Up @@ -3630,11 +3631,13 @@ describe('ReactSuspenseList', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in SuspenseList (at **)\n' +
' in Foo (at **)',
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in SuspenseList (at **)\n' +
' in Foo (at **)',
]);
Expand All @@ -3654,11 +3657,13 @@ describe('ReactSuspenseList', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in SuspenseList (at **)\n' +
' in Foo (at **)',
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in SuspenseList (at **)\n' +
' in Foo (at **)',
]);
Expand All @@ -3678,6 +3683,7 @@ describe('ReactSuspenseList', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in SuspenseList (at **)\n' +
' in Foo (at **)',
]);
Expand Down Expand Up @@ -3733,6 +3739,7 @@ describe('ReactSuspenseList', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Foo (at **)',
]);
});
Expand Down
32 changes: 32 additions & 0 deletions packages/react-reconciler/src/__tests__/ReactUse-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. Creating ' +
'promises inside a Client Component or hook is not yet ' +
'supported, except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
assertLog(['ABC']);
Expand Down Expand Up @@ -427,10 +428,12 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. Creating ' +
'promises inside a Client Component or hook is not yet ' +
'supported, except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
'A component was suspended by an uncached promise. Creating ' +
'promises inside a Client Component or hook is not yet ' +
'supported, except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
assertLog([
Expand Down Expand Up @@ -604,6 +607,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Async');
Expand Down Expand Up @@ -653,6 +657,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Async');
Expand Down Expand Up @@ -915,6 +920,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in ExcitingText (at **)',
]);

Expand Down Expand Up @@ -959,6 +965,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Kitchen (at **)',
]);

Expand All @@ -980,6 +987,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Kitchen (at **)',
]);

Expand All @@ -1001,6 +1009,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Kitchen (at **)',
]);
expect(root).toMatchRenderedOutput('banana dill');
Expand Down Expand Up @@ -1035,6 +1044,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Lexicon (at **)',
]);
expect(root).toMatchRenderedOutput('aguacate abogado');
Expand All @@ -1055,6 +1065,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in Lexicon (at **)',
]);
expect(root).toMatchRenderedOutput('aguacate avocat');
Expand Down Expand Up @@ -1200,6 +1211,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncText (at **)',
]);
expect(root).toMatchRenderedOutput('A(Loading B...)');
Expand All @@ -1226,6 +1238,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncText (at **)',
]);
expect(root).toMatchRenderedOutput('AB(Loading C...)');
Expand All @@ -1244,6 +1257,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncText (at **)',
]);
expect(root).toMatchRenderedOutput('ABC');
Expand Down Expand Up @@ -1279,10 +1293,12 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('A1');
Expand Down Expand Up @@ -1332,6 +1348,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Hi');
Expand Down Expand Up @@ -1367,6 +1384,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Hi');
Expand Down Expand Up @@ -1424,6 +1442,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('A');
Expand All @@ -1439,6 +1458,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('B');
Expand Down Expand Up @@ -1657,6 +1677,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Async');
Expand Down Expand Up @@ -1691,6 +1712,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Async');
Expand All @@ -1716,6 +1738,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput('Async!');
Expand Down Expand Up @@ -1777,10 +1800,12 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);
expect(root).toMatchRenderedOutput(
Expand Down Expand Up @@ -1969,6 +1994,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncClientComponent (at **)',
]);
},
Expand Down Expand Up @@ -2002,10 +2028,12 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncClientComponent (at **)',
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in AsyncClientComponent (at **)',
]);
});
Expand Down Expand Up @@ -2044,6 +2072,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);

Expand All @@ -2054,6 +2083,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in App (at **)',
]);

Expand Down Expand Up @@ -2095,6 +2125,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in div (at **)\n' +
' in App (at **)',
]);
Expand All @@ -2106,6 +2137,7 @@ describe('ReactUse', () => {
'A component was suspended by an uncached promise. ' +
'Creating promises inside a Client Component or hook is not yet supported, ' +
'except via a Suspense-compatible library or framework.\n' +
'See https://react.dev/reference/react/use\n' +
' in div (at **)\n' +
' in App (at **)',
]);
Expand Down