Skip to content

Commit ae66515

Browse files
committed
refactor: remove duplicated code
1 parent fa460cb commit ae66515

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/data_state.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Helpers for handling pending data.
22
3-
use std::fmt::{Debug, Display};
4-
53
use anyhow::anyhow;
64
use futures::channel::oneshot;
5+
use std::fmt::{Debug, Display};
76
use thiserror::Error;
87
use tracing::{error, warn};
98

@@ -81,13 +80,9 @@ impl<T, E: ErrorBounds> DataState<T, E> {
8180
ui.spinner();
8281
self.get(fetch_fn)
8382
}
84-
DataState::AwaitingResponse(rx) => {
85-
if let Some(new_state) = Self::await_data(rx) {
86-
*self = new_state;
87-
} else {
88-
ui.spinner();
89-
}
90-
CanMakeProgress::AbleToMakeProgress
83+
DataState::AwaitingResponse(_) => {
84+
ui.spinner();
85+
self.get(fetch_fn)
9186
}
9287
DataState::Present(_data) => {
9388
// Does nothing as data is already present

0 commit comments

Comments
 (0)