News for hackers. Stuff that matters.
Re:React Concurrent Mode by danabramov on Thursday October 24, 2019 @05:01PM (#21349126)
The thing that’s slow is arbitrary JS code people write in components. VDOM is not the point there. We want to make arbitrary JS code people write non-blocking, by using components as the “units of work” where we can yield.

Really though, you’re over focusing on the CPU part. The IO part is much more interesting.

Re:React Concurrent Mode by jbaudanza on Thursday October 24, 2019 @05:12PM (#21349225)
When you say "yield", you're talking about render functions throwing a Promise, right? Is there another kind of yield that arbitrary JS code people write in components can do that I'm missing?
Re:React Concurrent Mode by erikpukinskis on Thursday October 24, 2019 @08:11PM (#21350474)
Render functions, to my knowledge, can’t return a promise.

(And you don’t throw a promise, you return and reject it)

The issue at hand is fully synchronous render functions that, e.g., go through a giant list of objects and call a bunch of other render functions on each one synchronously.

This change allows that one function to finish, and interaction to continue before all the children render.

Re:React Concurrent Mode by jbaudanza on Thursday October 24, 2019 @08:14PM (#21350492)
The new suspense API works by throwing Promises when the data isn't ready yet.
Re:React Concurrent Mode by erikpukinskis on Sunday October 27, 2019 @12:59PM (#21370900)
I’m not sure what you mean by “throwing promises”...

You mean returning unresolved promises? Or returning rejected promises? Or just throwing an error?

Re:React Concurrent Mode by acemarke on Monday October 28, 2019 @11:39AM (#21377915)
Literally, _throwing_ a Promise.

React will catch promises thrown during rendering, and treat that as a request to "suspend" the component and come back to it later once the promise has resolved.

Re:React Concurrent Mode by danabramov on Thursday October 24, 2019 @05:19PM (#21349288)
No. I mean that we yield between calling different components. We can’t pause a giant blocking call in a render but we can amortise “death by a thousand cuts” across many components.