Skip to content

Commit

Permalink
Remove unwrap from hot restart/reload
Browse files Browse the repository at this point in the history
  • Loading branch information
itome committed Apr 14, 2024
1 parent 1a93310 commit 1d950de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/redux/thunk/hot_reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ where
return;
};
let session = session.read().await;
let run = &session.as_ref().unwrap().run;
let Some(session) = &session.as_ref() else {
return;
};
let run = &session.run;

run.hot_reload().await.unwrap();
if let Err(err) = run.hot_reload().await {
log::error!("Failed to hot reload: {}", err);
return;
}

while let Ok(params) = run.receive_app_progress().await {
if params.progress_id == Some("hot.reload".to_string()) && !params.finished {
Expand Down
11 changes: 9 additions & 2 deletions src/redux/thunk/hot_restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ where
return;
};
let session = session.read().await;
let run = &session.as_ref().unwrap().run;
run.hot_restart().await.unwrap();
let Some(session) = &session.as_ref() else {
return;
};
let run = &session.run;

if let Err(err) = run.hot_restart().await {
log::error!("Failed to hot restart: {}", err);
return;
}

while let Ok(params) = run.receive_app_progress().await {
if params.progress_id == Some("hot.restart".to_string()) && !params.finished {
Expand Down

0 comments on commit 1d950de

Please sign in to comment.