Fix write on render warning with read only signal props (#3194)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-11-13 11:48:43 -05:00
1 parent 128608f3b2
commit 21465390f8
3 files changed
+10 -4

No files matched your search

+6 -1
View File
@@ -52,7 +52,12 @@ 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;
_ = self.inner.try_write();
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();
});
}
}