-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add send_future_batch to ComponentLink #742
Comments
Thanks @hgzimmerman! This is actually making me realize that we didn't need to add What do you think about adding |
I think that's reasonable. |
I think once a lot of the current Readme's content is moved into external documentation, a section could be added to enumerate related crates to Yew, where yewtil, the router, various templates, along with other supported ecosystem crates people come up with could be featured. I'll try to migrate current futures functionality to Yewtil in a couple of days, at which point I'll open a PR removing it from this project. |
Actually, I think that a |
Ah yeah you're totally right, let's add that then!
…On Mon., Nov. 18, 2019, 3:40 p.m. Henry Zimmerman, ***@***.***> wrote:
Actually, I think that a send_self_batch is needed on component link in
order to implement the external send_future_batch because access to the
underlying scope isn't provided.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#742?email_source=notifications&email_token=AAIGXMIJXWMDUVDIK57PS2LQUL4SVA5CNFSM4JNSBRSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEL2V2Y#issuecomment-555199211>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIGXMNMHCVUZBDPUQ7CAJ3QUL4SVANCNFSM4JNSBRSA>
.
|
@hgzimmerman can this be closed? |
Yes, this can be closed. |
Description
I'm submitting a feature request
Similar to
send_back_batch
which takes a closure that returns aVec<Msg>
, and re-rendering happens if any of these returntrue
as theirShouldRender
return value, an async variant of this might be a useful to complimentsend_future
.This has the application of someone joining a series of fetch requests together and re-rendering once all of them finish.
I currently have code in my project that looks like this:
When what I really would like is:
This would allow you to load and display everything at once initially, and then be able to individually reuse each
Msg
to update parts independently once the component enters its normal update loop.What might be tangentially worth exploring would be a "thunkable" future that you register multiple futures to and after a defined delay after the first future resolves, it will batch any other resolved futures up to that point and send them to the component to be updated at once, doing this until all consumed futures are accounted for.
This could be used to manage fetching 8 things at once, where the first 6 resolve really quickly and can be re-rendered at once, but the remaining 2 take a while to finish. A mechanism like this would allow the developer using Yew to not have to think about the expected fetch timings in order to minimize re-renders, by exchanging 50-100ms of latency to wait for other futures to resolve in that window.
The text was updated successfully, but these errors were encountered: