Fix hot reloading component properties out of order (#2842)
* Fix hot reloading component properties out of order * ignore signal write warnings in hot reloading * Fix hot reloading components with only some literal properties * Add a test for hot reloading component properties
This commit is contained in:
1 parent
1e03e3946d
commit
4d6fb74e87
6 files changed
+48
-15
No files matched your search
@@ -29,6 +29,7 @@ tokio-stream = { version = "0.1.12", features = ["sync"], optional = true }
|
||||
futures-util = { workspace = true, features = ["async-await-macro"], optional = true }
|
||||
tokio = { workspace = true, features = ["sync", "rt-multi-thread"], optional = true }
|
||||
tracing = { workspace = true }
|
||||
warnings.workspace = true
|
||||
|
||||
# use rustls on android
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::HotReloadMsg;
|
||||
use dioxus_core::{ScopeId, VirtualDom};
|
||||
use dioxus_signals::Writable;
|
||||
use warnings::Warning;
|
||||
|
||||
/// Applies template and literal changes to the VirtualDom
|
||||
///
|
||||
@@ -13,7 +14,11 @@ pub fn apply_changes(dom: &mut VirtualDom, msg: &HotReloadMsg) {
|
||||
let id = &template.location;
|
||||
let value = template.template.clone();
|
||||
if let Some(mut signal) = ctx.get_signal_with_key(id) {
|
||||
signal.set(Some(value));
|
||||
dioxus_signals::warnings::signal_read_and_write_in_reactive_scope::allow(|| {
|
||||
dioxus_signals::warnings::signal_write_in_component_body::allow(|| {
|
||||
signal.set(Some(value));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user