Skip to content

Commit

Permalink
#33: Add better state checks to prevent not needed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
PetoMPP committed Dec 23, 2023
1 parent e286e5d commit c25d7cf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/organisms/editor/atoms/delete_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ pub fn delete_button(props: &EditorProps) -> Html {
let Some(resid) = &props.resid else {
return;
};
if let EditorState::Loading = &props.state {
return;
match &props.state {
&EditorState::Ok(Some(_)) | &EditorState::Err(_) => return,
_ => {}
}
match &(*state) {
&State::Loading => return,
_ => {}
}
let resid = resid.clone();
state.set(State::Loading);
Expand Down

0 comments on commit c25d7cf

Please sign in to comment.