Comment

Comment by danabramov

>That seems a clear problem with the server side examples as presented in the RFC: they use synchronous node 'fs' instead of FS Promises

It isn't synchronous, it only looks so. It actually uses FP Promises under the hood[1]. We're doing a bit of a trick there (it throws a special value the first time, and then React retries when it's resolved). Then the result gets cached, and the repeated render succeeds synchronously. We will describe this mechanism in detail in a future RFC.

All of the examples in the demo (including fetch, readFile, and the DB query call) are async under the hood.

However, they do leave us the ability to use sync I/O in the cases where it makes sense (depends on whether we have other work to do, etc).

[1]: https://github.com/facebook/react/blob/6cbb9394d1474e3a728b4...

parent danabramov 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton