rsnext/packages
Andrew Clark b425b40aac
Replace custom Thenable type with native Promises (#58337)
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>
2023-11-12 08:45:43 +01:00
..
create-next-app v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
eslint-config-next v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
eslint-plugin-next v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
font v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next Replace custom Thenable type with native Promises (#58337) 2023-11-12 08:45:43 +01:00
next-bundle-analyzer v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-codemod v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-env v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-mdx v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-plugin-storybook v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-polyfill-module v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-polyfill-nomodule v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
next-swc v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
react-dev-overlay v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
react-refresh-utils v14.0.3-canary.3 2023-11-11 23:23:28 +00:00
third-parties v14.0.3-canary.3 2023-11-11 23:23:28 +00:00