make the web history a higher priority than the liveview history when compiling to wasm

This commit is contained in:
Evan Almloff committed 2024-01-08 13:50:01 -06:00
1 parent 08a679147f
commit cfbec8240e
1 file changed
+8 -5
+8 -5
View File
@@ -88,15 +88,18 @@ where
{ {
pub(crate) fn take_history(&mut self) -> Box<dyn AnyHistoryProvider> { pub(crate) fn take_history(&mut self) -> Box<dyn AnyHistoryProvider> {
self.history.take().unwrap_or_else(|| { 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::<AnyHistoryProviderImplWrapper<R, WebHistory<R>>>::default(); let history = Box::<AnyHistoryProviderImplWrapper<R, WebHistory<R>>>::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::<AnyHistoryProviderImplWrapper<R, LiveviewHistory<R>>>::default();
// If neither of the above are true, use the memory history.
#[cfg(all( #[cfg(all(
not(feature = "liveview"), not(all(target_arch = "wasm32", feature = "web")),
any(not(target_arch = "wasm32"), not(feature = "web")) not(all(feature = "liveview", not(target_arch = "wasm32"))),
))] ))]
let history = Box::<AnyHistoryProviderImplWrapper<R, MemoryHistory<R>>>::default(); let history = Box::<AnyHistoryProviderImplWrapper<R, MemoryHistory<R>>>::default();
#[cfg(feature = "liveview")]
let history = Box::<AnyHistoryProviderImplWrapper<R, LiveviewHistory<R>>>::default();
history history
}) })
} }