b425b40aac
Next.js's implementation includes a custom Thenable type based on a similar one used in React's codebase. It was used to implement a userspace equivalent of the React.use API before that API became stable, by throwing a promise-like object and tracking the status on an expando field. However, it didn't cover all the same cases and behaviors that React.use does, which led to some subtle bugs like the one fixed by @ztanner in https://github.com/vercel/next.js/pull/55690. Now that React.use is stable, and we use that for suspending instead of throwing a promise, we no longer need our custom Thenable type. I've removed the type and associated functions, and updated our types to use Promise instead. Even in cases where a function does return a thenable-object rather than a native promise, like React Flight's createFromFetch, we should use TypeScript's built-in PromiseLike utility. Currently, though, we always await these objects anyway (in fetch-server-response.ts), which turns them into promises. So Promise is almost always sufficient. Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
create-next-app | ||
eslint-config-next | ||
eslint-plugin-next | ||
font | ||
next | ||
next-bundle-analyzer | ||
next-codemod | ||
next-env | ||
next-mdx | ||
next-plugin-storybook | ||
next-polyfill-module | ||
next-polyfill-nomodule | ||
next-swc | ||
react-dev-overlay | ||
react-refresh-utils | ||
third-parties |