From 0c953e497626d54fcfa3b5699bc7ad74f0614af6 Mon Sep 17 00:00:00 2001 From: Martin Molzer Date: Sat, 28 Dec 2024 17:11:14 +0100 Subject: [PATCH] fix panic in panic don't set the panic hook if we are already panicking --- packages/yew/src/renderer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/yew/src/renderer.rs b/packages/yew/src/renderer.rs index 591d5da07e7..f9bcd34c967 100644 --- a/packages/yew/src/renderer.rs +++ b/packages/yew/src/renderer.rs @@ -24,6 +24,10 @@ pub fn set_custom_panic_hook(hook: Box) + Sync + Send + 's } fn set_default_panic_hook() { + if std::thread::panicking() { + // very unlikely, but avoid hitting this when running parallel tests. + return; + } if !PANIC_HOOK_IS_SET.with(|hook_is_set| hook_is_set.replace(true)) { std::panic::set_hook(Box::new(console_error_panic_hook::hook)); }