From a899c481270a26d51daf3606c8bf3877d13638de Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 23 May 2024 16:15:39 +0200 Subject: [PATCH] fix(web): clear errored status on cached fetch too --- web/src/page/debug.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/page/debug.rs b/web/src/page/debug.rs index d80a6a61..2a783692 100644 --- a/web/src/page/debug.rs +++ b/web/src/page/debug.rs @@ -20,11 +20,15 @@ pub fn DebugPage() -> impl IntoView { cached_query, move |(query, cached)| async move { set_text.set(query.clone()); + set_error.set(false); if query.is_empty() { return serde_json::Value::Null }; if cached { match CACHE.get(&query) { Some(x) => (*x).clone(), - None => serde_json::Value::Null, + None => { + set_error.set(true); + serde_json::Value::Null + }, } } else { debug_fetch(&format!("{URL_BASE}/proxy?id={query}"), auth, set_error).await @@ -98,7 +102,6 @@ pub fn DebugPage() -> impl IntoView { // this is a rather weird way to fetch but i want to see the bare error text if it fails! async fn debug_fetch(url: &str, token: Auth, error: WriteSignal) -> serde_json::Value { - error.set(false); match Http::request::<()>(reqwest::Method::GET, url, None, token).await { Ok(res) => { if res.error_for_status_ref().is_err() {