Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekleog committed Feb 21, 2024
1 parent db14002 commit fef8b55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/yew/src/functional/hooks/use_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ where
move |deps| {
result.set(None);
let future = f(deps);
wasm_bindgen_futures::spawn_local(async move {
yew::platform::spawn_local(async move {
let res = future.await;
result.set(Some(res));
});
Expand All @@ -31,7 +31,7 @@ pub struct UseAsyncHandle<T> {
}

#[derive(Debug)]
pub enum UseAsyncResult<'a, T> {
pub enum UseAsyncStatus<'a, T> {
Pending,
Ready(&'a T),
}
Expand All @@ -47,10 +47,10 @@ impl<T: fmt::Debug> fmt::Debug for UseAsyncHandle<T> {
}

impl<T> UseAsyncHandle<T> {
pub fn status(&self) -> UseAsyncResult<'_, T> {
pub fn status(&self) -> UseAsyncStatus<'_, T> {
match &*self.inner {
None => UseAsyncResult::Pending,
Some(res) => UseAsyncResult::Ready(res),
None => UseAsyncStatus::Pending,
Some(res) => UseAsyncStatus::Ready(res),
}
}
}

0 comments on commit fef8b55

Please sign in to comment.