remove signal write warnings (#4024)

This commit is contained in:
Evan Almloff authored and GitHub committed 2025-04-22 00:32:57 -07:00
1 parent 1ac57f1a36
commit d857629115
5 files changed
+4 -30

No files matched your search

+1 -5
View File
@@ -1,4 +1,3 @@
use crate::warnings::{signal_read_and_write_in_reactive_scope, signal_write_in_component_body};
use crate::write::Writable;
use crate::{read::Readable, ReadableRef, Signal};
use crate::{read_impls, GlobalMemo};
@@ -12,7 +11,6 @@ use std::{
use dioxus_core::prelude::*;
use futures_util::StreamExt;
use generational_box::{AnyStorage, BorrowResult, UnsyncStorage};
use warnings::Warning;
struct UpdateInformation<T> {
dirty: Arc<AtomicBool>,
@@ -181,9 +179,7 @@ where
let result = if needs_update {
drop(read);
// We shouldn't be subscribed to the value here so we don't trigger the scope we are currently in to rerun even though that scope got the latest value because we synchronously update the value: https://github.com/DioxusLabs/dioxus/issues/2416
signal_read_and_write_in_reactive_scope::allow(|| {
signal_write_in_component_body::allow(|| self.recompute())
});
self.recompute();
self.inner.inner.try_read_unchecked()
} else {
Ok(read)
+1 -6
View File
@@ -55,12 +55,7 @@ impl<T: 'static, S: Storage<SignalData<T>>> ReadOnlySignal<T, S> {
/// Mark any readers of the signal as dirty
pub fn mark_dirty(&mut self) {
use crate::write::Writable;
use warnings::Warning;
// We diff props while rendering, but we only write to the signal if it has
// changed so it is safe to ignore the warning
crate::warnings::signal_write_in_component_body::allow(|| {
_ = self.inner.try_write();
});
_ = self.inner.try_write();
}
}
-5
View File
@@ -692,11 +692,6 @@ impl<T: 'static, S: Storage<SignalData<T>>> Drop for SignalSubscriberDrop<T, S>
"Write on signal at {} finished, updating subscribers",
self.origin
);
crate::warnings::signal_write_in_component_body(self.origin);
crate::warnings::signal_read_and_write_in_reactive_scope::<T, S>(
self.origin,
self.signal,
);
}
self.signal.update_subscribers();
}