From 43efdf18a08cd2afb24e7b1511593baf94d6bd05 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sat, 8 Mar 2025 07:57:12 -0800 Subject: [PATCH] web: reload page on fetch error. Should help with expired cookies --- web/src/state.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/state.rs b/web/src/state.rs index 9327935..45ddad9 100644 --- a/web/src/state.rs +++ b/web/src/state.rs @@ -292,12 +292,16 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { ) }); } - Msg::FrontPageResult(Err(e)) => error!("error FrontPageResult: {e:?}"), + Msg::FrontPageResult(Err(e)) => { + orders.send_msg(Msg::Reload); + error!("error FrontPageResult: {e:?}"); + } Msg::FrontPageResult(Ok(graphql_client::Response { data: None, errors: None, .. })) => { + orders.send_msg(Msg::Reload); error!("FrontPageResult no data or errors, should not happen"); } Msg::FrontPageResult(Ok(graphql_client::Response { @@ -305,6 +309,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { errors: Some(e), .. })) => { + orders.send_msg(Msg::Reload); error!("FrontPageResult error: {e:?}"); } Msg::FrontPageResult(Ok(graphql_client::Response { @@ -400,6 +405,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { orders.send_msg(Msg::WindowScrolled); } Msg::ShowThreadResult(bad) => { + orders.send_msg(Msg::Reload); error!("show_thread_query error: {bad:#?}"); } Msg::CatchupRequest { query } => { @@ -432,6 +438,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders) { } } Msg::CatchupResult(bad) => { + orders.send_msg(Msg::Reload); error!("catchup_query error: {bad:#?}"); } Msg::SelectionSetNone => {