Skip to content

Commit 6e78c6d

Browse files
authored
fix: Set Mutations to loading state when they are loading (#34)
The first call to a mutation stays on the Pending state instead of `Loading(None)`. This PR fixes it so that called mutations get properly set to `Loading`, even when they don't have a value.
1 parent e6c75fb commit 6e78c6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/use_mutation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<T, E> MutationState<T, E> {
161161
}
162162

163163
pub fn set_loading(&mut self) {
164-
let result = mem::replace(self, Self::Pending).into();
164+
let result = mem::replace(self, Self::Loading(None)).into();
165165
if let Some(v) = result {
166166
*self = Self::Loading(Some(v))
167167
}

0 commit comments

Comments
 (0)