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

Generated
+3 -2
View File
@@ -12371,11 +12371,12 @@ dependencies = [
[[package]]
name = "warnings"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c672c7629eeed21c37d7a96ee9c0287b86a5e29b5730773117e4261d1a73ca"
checksum = "64f68998838dab65727c9b30465595c6f7c953313559371ca8bf31759b3680ad"
dependencies = [
"pin-project",
"tracing",
"warnings-macro",
]
+1 -1
View File
@@ -142,7 +142,7 @@ manganis = { path = "packages/manganis/manganis", version = "0.6.0-alpha.4" }
manganis-core = { path = "packages/manganis/manganis-core", version = "0.6.0-alpha.4" }
manganis-macro = { path = "packages/manganis/manganis-macro", version = "0.6.0-alpha.4" }
warnings = { version = "0.2.0" }
warnings = { version = "0.2.1" }
# a fork of pretty please for tests - let's get off of this if we can!
+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();
});
}
}