Make hot reload error only show once (#1725)

This commit is contained in:
Exotik850 2023-12-17 15:26:40 -06:00 committed by GitHub
parent 2321c1ad44
commit cf413780c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,6 +127,7 @@ async fn start_desktop_hot_reload(hot_reload_state: HotReloadState) -> Result<()
let file_map = hot_reload_state.file_map.clone();
let channels = channels.clone();
let aborted = aborted.clone();
let mut error_shown = false;
move || {
loop {
//accept() will block the thread when local_socket_stream is in blocking mode (default)
@ -154,7 +155,8 @@ async fn start_desktop_hot_reload(hot_reload_state: HotReloadState) -> Result<()
println!("Connected to hot reloading 🚀");
}
Err(err) => {
if err.kind() != std::io::ErrorKind::WouldBlock {
if !error_shown && err.kind() != std::io::ErrorKind::WouldBlock {
error_shown = true;
println!("Error connecting to hot reloading: {} (Hot reloading is a feature of the dioxus-cli. If you are not using the CLI, this error can be ignored)", err);
}
}