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

+7 -1
View File
@@ -46,7 +46,13 @@ impl<T: 'static, S: Storage<SignalData<T>>> ReadOnlySignal<T, S> {
/// This should only be used by the `rsx!` macro.
pub fn __set(&mut self, value: T) {
use crate::write::Writable;
self.inner.set(value);
use warnings::Warning;
// This is only called when converting T -> ReadOnlySignal<T> which will not cause loops
crate::warnings::signal_write_in_component_body::allow(|| {
crate::warnings::signal_read_and_write_in_reactive_scope::allow(|| {
self.inner.set(value);
});
});
}
#[doc(hidden)]