react-request icon indicating copy to clipboard operation
react-request copied to clipboard

React Suspense support

Open jamesplease opened this issue 6 years ago • 4 comments

React's future fetcher/Suspense API will have ramifications for React Request. It's too early to say anything with certainty right now, but once that gets more fleshed out I should make a plan here.

At the end of the day, the resolution of this issue will likely be an update to the documentation.

Based on the future fetcher preview, my current thoughts are:

  1. future fetcher does not implement deduping, so a wrapper or alternative solution may still be necessary. Maybe something like React Request could add that
  2. future fetcher may conflate the two loading states ( #144 ). It the final API does this, then it may make sense for there to be a wrapper for it
  3. I am pretty sure that the entire future fetcher demo can be polyfilled right now using the existing React API + render props. Once the API is more finalized, I might make a polyfill for it, and that polyfill may supply additional features (like deduping and splitting out loading states)
  4. A Promise-based API may make more sense in the future than one that tries to map fetch's API. This is something I could do now, but I want to wait because future fetcher may implement the features differently/better. I don't want to write something just to rewrite it or throw it out in a few months 🙂

jamesplease avatar Apr 02 '18 17:04 jamesplease

I'm closing this as revisit. We won't know more until React Suspense is closer to being finalized.

Feel free to leave your comments/ideas in this issue, though!

jamesplease avatar Apr 21 '18 17:04 jamesplease

Reopening. Apollo's React Client has a solution that acts as a prop on their Query component. I can use that as motivation on how to implement it here.

jamesplease avatar Jul 09 '18 21:07 jamesplease

Can you provide a link pointing at that?

pkoch avatar Oct 27 '18 18:10 pkoch

I won’t have time to do that for you

jamesplease avatar Oct 27 '18 23:10 jamesplease