Closed
Description
Do you want to request a feature or report a bug?
Request a feature
What is the current behavior?
If you throw a promise that neither resolves nor rejects, you hit the suspense fallback UI indefinitely and receive no console messaging that helps you debug this.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
All versions that allow for suspense
Proposed feature
Log a warning to the console if a suspense promise takes longer than a certain amount of time to settle. Here is some code demonstrating what that could look like inside of the react codebase:
try {
renderComponent(...);
} catch (err) {
if (err && err.then) {
const timeoutId = setTimeout(() => {
console.warn(`A suspense promise triggered in component <Foo /> did not resolve nor reject after 3 seconds. If the promise never settles, the suspense fallback UI will be shown forever.`)
}, 3000)
err.finally(() => {
clearTimeout(timeoutId);
})
// Now actually do all the suspense magicks...
}
}