Re:React Concurrent Mode
by kylehardgrave on Friday October 25, 2019 @03:41PM
(#21358518)
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?
Re:React Concurrent Mode
by danabramov on Saturday October 26, 2019 @10:23PM
(#21367525)
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)?
Re:React Concurrent Mode
by danabramov on Saturday October 26, 2019 @10:25PM
(#21367530)
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.
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.