Unify the warning system (#2649)

* unify the warning system

* fix VirtualDom::new warning with a component

* move warnings to dioxuslabs

* also allow writes in the component body when converting from T -> ReadOnlySignal<T>

* fix clippy from merge conflict

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2024-07-24 15:50:36 -07:00
1 parent f8cb07e673
commit a6c025c8ef
10 files changed
+132 -63

No files matched your search

+8 -1
View File
@@ -110,7 +110,14 @@ pub fn use_reactive<O, D: Dependency>(
non_reactive_data.out()
});
if !first_run && non_reactive_data.changed(&*last_state.peek()) {
last_state.set(non_reactive_data.out());
use warnings::Warning;
// In use_reactive we do read and write to a signal during rendering to bridge the reactive and non-reactive worlds.
// We ignore
dioxus_signals::warnings::signal_read_and_write_in_reactive_scope::allow(|| {
dioxus_signals::warnings::signal_write_in_component_body::allow(|| {
last_state.set(non_reactive_data.out())
})
});
}
move || closure(last_state())
}