Repository navigation
|
What is the replacement for a FetchTask? before you could create a task that runs a request asynchronously and executes the component link callback to send a result to the component. eg: fn get_data() -> FetchTask {
let callback = self.link.callback(
|response: Response| {
let data = response.into_body();
Msg::GotData(data.unwrap())
},
);
let request = Request::get("url").body(Nothing).unwrap();
FetchService::fetch(request, callback).unwrap()
}you need to store the FetchTask otherwise the task is cancelled. https://yew.rs/docs/0.18.0/concepts/services/fetch I thought I could implement this behavior with tokio tasks however the borrow checker complains about the reference to the callback. Is the functionality of the FetchTask implemented in some third-party library for Yew 0.19. What's the recommended way we do this now? |
Replies: 1 comment 1 reply
|
Services have been removed in 0.19. If you are trying to resolve a future, you can use You can find more information about service alternatives in the migration guide: https://yew.rs/docs/migration-guides/yew/from-0_18_0-to-0_19_0#services |
Services have been removed in 0.19.
If you are trying to resolve a future, you can use
ctx.link().send_future().You can find more information about service alternatives in the migration guide:
https://yew.rs/docs/migration-guides/yew/from-0_18_0-to-0_19_0#services