Bug: use
function doesn't warn about uncached promise when promise doesn't resolve immediately
#31790
Labels
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
When I pass an uncached promise that doesn't resolve immediately to the
use
function, (e. g.use(new Promise(resolve => setTimeout(resolve, 1000)))
), I don't get the "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." warning.Instead, I get into an infinite loop as the Promise keeps getting recreated.
(When I use a promise that gets resolved immediately, like
use(new Promise(resolve => resolve())
, I do get the warning message as expected)React version:
^19.0.0
Steps To Reproduce
Link to code example:
https://codesandbox.io/p/sandbox/modest-merkle-cr7qcn
The current behavior
No warning message gets logged
The expected behavior
I get the "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." warning regardless of how long the promise passed to the
use
function takes to resolve.The text was updated successfully, but these errors were encountered: