facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
225.33k stars 45.95k forks source link

[Umbrella] Releasing Suspense #13206

Open acdlite opened 6 years ago

acdlite commented 6 years ago

Let's use this issue to track the remaining tasks for releasing Suspense to open source.

Last updated: March 24, 2022

Blog post: The Plan for React 18

Completed: React 16

Completed: React 18 Alpha

Completed: React 18

Features that may or may not appear in 18.x

React 18.x (post-18.0): Suspense for Data Fetching

All of the above changes are foundational architectural improvements to <Suspense>. They fill the gaps in the mechanism and make it deeply integrated with all parts of React (client and server). However, they don't prescribe a particular data fetching strategy. That will likely come after the 18.0 release, and we're hoping that to have something during the next 18.x minor releases.

This work will include:

gaearon commented 3 years ago

Btw, @rickhanlonii updated the time slicing demo (from the original JSConf Iceland talk) if you wanna play with it :-) as you can see some APIs have changed but they should make a bit more sense now (figuring out the right APIs and heuristics was a large part of the effort).

https://github.com/facebook/react/pull/21401 https://react-beta-seven.vercel.app/

(keep in mind the demo is not representative of the most efficient way to draw a chart per se, but shows some of the benefits we want to unlock in general for arbitrary component trees)

gaearon commented 3 years ago

Finalize other API semantics and defaults. (not started)

That’s one of the remaining areas to polish.

This is in progress. We've tweaked and unprefixed some APIs (for the experimental channel only). https://github.com/facebook/react/pull/21488

ntucker commented 3 years ago

@gaearon That's awesome! Does that mean a stable release with these things is coming soon? Will this be React 17.1?

gaearon commented 3 years ago

We are getting closer to the first release that would have an actual number version on it. It will be tagged as an alpha. Like always, we’ll announce it on the blog. A stable release is going to take place at least several months after that since we’re going to work closely with the ecosystem and it will take some more time to fill in the gaps. Sorry this is brief, preparing the communication for this is another part of the team’s ongoing work.

zhangchao828 commented 3 years ago

With regard to:

Ecosystem compatibility and good defaults. It doesn't help if we release something that nobody can use today because it doesn't work with their libraries or existing approaches.

Is there anything the community can do to help?

At the company I work at, we're heavy users of MobX, and so we would be keen to help figure out how Concurrent Mode \ Time slicing can work with MobX. I imagine there are similar companies out there as well.

see: https://github.com/mobxjs/mobx-react-lite/issues/53#issuecomment-487371481

gaearon commented 3 years ago

Yesterday, we published The Plan for React 18.

tldr:

React 18 will include a lot of foundational work for Suspense. This includes a brand new streaming server renderer which uses the <Suspense> boundaries to stream HTML and to hydrate the page in chunks, dramatically improving responsiveness. However, Suspense for Data Fetching will likely not be a part of the first 18.0 release, but follow after (likely in a 18.x minor release).

To reflect the current roadmap, I have updated the initial post in this thread. It shows the work we have already done over these years (most checkboxes correspond to multiple months of work), and the remaining work is grouped by the release timeline.

gaearon commented 3 years ago

Additionally, I'd like to share this thread from @rickhanlonii reflecting on the journey to React 18 alpha. I hope it provides some insight on why these things are taking time and we could not get this Alpha out earlier.

Jack-Works commented 3 years ago

Hi! I'm trying to upgrade from the nightly version to alpha but I found unstable_getCacheForType wasn't included in the alpha version

gaearon commented 3 years ago

Yes, the Cache API is still more experimental than the rest so you’ll need an @experimental release to use that.

koba04 commented 3 years ago

I know that removing componentWillMount, componentWillReceiveProps, and componentWillUpdate was postponed at the v17. Will these APIs be still kept in v18, or be only kept UNSAFE_ prefixed lifecycle methods like the migration plan? https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path

gaearon commented 3 years ago

We have not made a decision on this yet. We will include information about any deprecations or removals in future blog posts.

Ayc0 commented 3 years ago

What would happen if a library uses the new APIs like startTransition but its users still uses ReactDOM.render instead of the new ReactDOM.createRoot? Will it crash?

gaearon commented 3 years ago

It won’t crash but it also won’t get treated as a transition. Just a regular state update.

gaearon commented 2 years ago

Wrote some updates on what we're working on and the state of different pieces. It's about React 18 overall but some parts there relate to Suspense: https://github.com/reactwg/react-18/discussions/98#discussioncomment-1318753

gaearon commented 2 years ago

I've updated the umbrella to document the current progress. There is nothing more blocking the initial React 18 release, so we've released the last call for feedback:

gaearon commented 1 year ago

We've been making some changes to the strategy, in particular, to avoid the need for "forked" IO libraries like react-fetch for every single use case. A wrapper could still make some things more ergonomic, but the current plan is to allow easy compatibility with any async/await code. This experimental API is the first step towards that: https://github.com/facebook/react/pull/25084

tobias-tengler commented 1 year ago

@gaearon is this new API superseding the Suspense cache (unstable_Cache) or are they meant to both exist alongside each other?

gaearon commented 1 year ago

I think we’re not super clear yet on whether Cache will be moving forward or not, but this API could potentially work together with it in the future.

dante01yoon commented 1 year ago

This might be outdated question after v18 release, but I wonder we don't need using loadable-components library for using Suspense in SSR?