progress guessing
bryanrasmussen opened this issue · 6 comments
this isn't so much an issue as a request for new functionality in line with the fetch progress indicators project https://github.com/AnthumChris/fetch-progress-indicators so that I could pass to my Loading fallback how many bytes there were in all to get and how much was left. (or is that actually possible now, haven't gone through the code)
I can fork and make pull request on this if you want
Hey, thanks for opening up the discussion.
The "fetch" in this lib is not tied to the Fetch API, but it can be any async functions.
Furthermore, I don't think we can return state while in suspense, so I'm not sure how to implement the progress indicator. "Incremental loading" is a similar idea, but it's for multiple async functions.
pass to my Loading fallback
Ah, so it's a callback function. That may work, but still the indicator must be shown in non-suspended component, which sounds a bit weird.
hmm, ok sorry I had misunderstood and thought it was just basically for using fetch with suspense.
basically I'm working on a loading animation article where the loading is an svg animation with some guesstimation as to when load complete helping to set the animation (so instead of a indefinitely recurring animation you get an animation that goes from 0 to complete [or goes away when before complete reached because first data being shown])
and I was hoping to combine the loading animation guessing technique with render-as-you-fetch somehow.
The basic idea seems good. Let's assume we only used the Fetch API and could know the progress. Do you show the loading svg animation in the Suspense fallback? A question is how the svg gets progress information.
Thanks for the examples.
If you were to use <Suspense fallback={<Loading progress={progress} />}
, I'd expect we could load multiple images under the tree. In other words, if the progress is just for one image, we wouldn't need Suspense
, but just use the current (traditional) React, maybe?