From cfbec8240e3864fd808b8a0c1185b39e895aed8f Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 8 Jan 2024 13:50:01 -0600 Subject: [PATCH] make the web history a higher priority than the liveview history when compiling to wasm --- packages/router/src/router_cfg.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/router/src/router_cfg.rs b/packages/router/src/router_cfg.rs index d243209f6..e0d2ce358 100644 --- a/packages/router/src/router_cfg.rs +++ b/packages/router/src/router_cfg.rs @@ -88,15 +88,18 @@ where { pub(crate) fn take_history(&mut self) -> Box { self.history.take().unwrap_or_else(|| { - #[cfg(all(not(feature = "liveview"), target_arch = "wasm32", feature = "web"))] + // If we are on wasm32 and the web feature is enabled, use the web history. + #[cfg(all(target_arch = "wasm32", feature = "web"))] let history = Box::>>::default(); + // If we are not on wasm32 and the liveview feature is enabled, use the liveview history. + #[cfg(all(feature = "liveview", not(target_arch = "wasm32")))] + let history = Box::>>::default(); + // If neither of the above are true, use the memory history. #[cfg(all( - not(feature = "liveview"), - any(not(target_arch = "wasm32"), not(feature = "web")) + not(all(target_arch = "wasm32", feature = "web")), + not(all(feature = "liveview", not(target_arch = "wasm32"))), ))] let history = Box::>>::default(); - #[cfg(feature = "liveview")] - let history = Box::>>::default(); history }) }