mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-16 21:58:25 +00:00
chore: reimplement usefuture::state
This commit is contained in:
parent
f664ce8fe0
commit
62d30bc254
1 changed files with 11 additions and 12 deletions
|
@ -143,22 +143,21 @@ impl<T> UseFuture<T> {
|
|||
self.task.get()
|
||||
}
|
||||
|
||||
/// Get the current stateof the future.
|
||||
/// Get the current state of the future.
|
||||
pub fn state(&self) -> UseFutureState<T> {
|
||||
todo!()
|
||||
// match (&self.task.get(), &self.value) {
|
||||
// // If we have a task and an existing value, we're reloading
|
||||
// (Some(_), Some(val)) => UseFutureState::Reloading(val),
|
||||
match (&self.task.get(), &self.value()) {
|
||||
// If we have a task and an existing value, we're reloading
|
||||
(Some(_), Some(val)) => UseFutureState::Reloading(val),
|
||||
|
||||
// // no task, but value - we're done
|
||||
// (None, Some(val)) => UseFutureState::Complete(val),
|
||||
// no task, but value - we're done
|
||||
(None, Some(val)) => UseFutureState::Complete(val),
|
||||
|
||||
// // no task, no value - something's wrong? return pending
|
||||
// (None, None) => UseFutureState::Pending,
|
||||
// no task, no value - something's wrong? return pending
|
||||
(None, None) => UseFutureState::Pending,
|
||||
|
||||
// // Task, no value - we're still pending
|
||||
// (Some(_), None) => UseFutureState::Pending,
|
||||
// }
|
||||
// Task, no value - we're still pending
|
||||
(Some(_), None) => UseFutureState::Pending,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue