fix: interaction between both hot-reload engines (#4083)
* fix: interaction between both hot-reload engines * correct comment
This commit is contained in:
1 parent
b2ec1d957b
commit
d00636ca31
4 files changed
+601
-506
No files matched your search
Generated
+589
-500
File diff suppressed because it is too large.
Load diff
@@ -393,11 +393,9 @@ impl AppServer {
|
||||
}
|
||||
}
|
||||
|
||||
// We decided to make the hotpatch engine drive *all* hotreloads, even if they are just RSX
|
||||
// hot-reloads. This is a temporary measure to thoroughly test the hotpatch engine until
|
||||
// we're comfortable with both co-existing. Keeping both would lead to two potential sources
|
||||
// of errors, and we want to avoid that for now.
|
||||
if needs_full_rebuild || self.use_hotpatch_engine {
|
||||
// todo - we need to distinguish between hotpatchable rebuilds and true full rebuilds.
|
||||
// A full rebuild is required when the user modifies static initializers which we haven't wired up yet.
|
||||
if needs_full_rebuild {
|
||||
if self.use_hotpatch_engine {
|
||||
self.client.patch_rebuild(files.to_vec());
|
||||
if let Some(server) = self.server.as_mut() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use dioxus_core::internal::HotReloadedTemplate;
|
||||
use dioxus_core::{ScopeId, VirtualDom};
|
||||
use dioxus_signals::{GlobalKey, Writable};
|
||||
use dioxus_signals::{GlobalKey, Signal, Writable};
|
||||
|
||||
pub use dioxus_devtools_types::*;
|
||||
pub use subsecond;
|
||||
@@ -37,6 +38,7 @@ pub fn try_apply_changes(dom: &VirtualDom, msg: &HotReloadMsg) -> Result<(), Pat
|
||||
if msg.for_build_id == Some(dioxus_cli_config::build_id()) {
|
||||
unsafe { subsecond::apply_patch(jump_table) }?;
|
||||
dioxus_core::prelude::force_all_dirty();
|
||||
ctx.clear::<Signal<Option<HotReloadedTemplate>>>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,6 +268,12 @@ impl GlobalLazyContext {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// Clear all global signals of a given type.
|
||||
pub fn clear<T: 'static>(&self) {
|
||||
self.map.borrow_mut().retain(|_k, v| !v.is::<T>());
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the global context for signals
|
||||
|
||||
Reference in new issue
Block a user