Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s a bit tricky because as the docs explain, the only Suspense integration we currently use in production is Relay. I definitely agree we need a complete Relay example that people can run (maybe Relay docs have one already?). But a lot of people don’t know Relay so it would be hard to teach both new UI patterns like useTransition and Relay at the same time. This is why we didn’t do it in the main docs.

How a form would work really depends on how your data solution manages a cache. Relay has one answer for that, some other solution may have completely different answers. So I wanted to keep the first examples simpler and less opinionated.

As more libraries start to integrate Suspense I think you’ll see more such complete examples. But this release wasn’t for the end users as much — it was more for people who would create those libraries.

Hope that makes sense.



Maybe I just missed this, but I couldn't find any kind of guidance for library maintainers on implementing Suspense. Reading the demo code + React-Cache it seems that it's basically about providing an interface that throws unresolved promises, but is there any more detailed documentation?


We'll likely add more documentation about this -- however, indeed, the contract fits in those 10 lines. There's not much more that's needed on the integration side.

The real questions (where and for how long do you cache, what triggers are fetch, how to avoid waterfalls) are something that the library itself is better positioned to answer and figure out. We don't have a particular suggestion there (although the docs mention our recommendation).


> depends on how your data solution manages a cache

> But this release wasn’t for the end users as much — it was more for people who would create those libraries.

Where is the documentation to create these libraries (cache integration, etc)?


Every example on those pages has a reference toy implementation in `fakeApi.js`. You can use it as a base -- that's the whole contract that React cares about. We'll describe it in more detail later.


Thanks a lot Dan




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: