Fix memo dirty flag after unrelated writes (#2992)

* Fix memo dirty flag after unrelated writes

* improve regression test

* Update packages/signals/tests/memo.rs

Co-authored-by: Matt Hunzinger <matt@hunzinger.me>

* Update packages/signals/tests/memo.rs

Co-authored-by: Matt Hunzinger <matt@hunzinger.me>

* Update packages/signals/tests/memo.rs

Co-authored-by: Matt Hunzinger <matt@hunzinger.me>

---------

Co-authored-by: Matt Hunzinger <matt@hunzinger.me>
This commit is contained in:
Evan AlmloffandMatt Hunzinger authored and GitHub committed 2024-10-01 15:47:54 +00:00
1 parent 5925f3c8ee
commit d1c84d9a25
4 files changed
+163 -130

No files matched your search

+4 -3
View File
@@ -139,10 +139,11 @@ impl<T: 'static> Memo<T> {
drop(peak);
let mut copy = self.inner;
copy.set(new_value);
update_write
.dirty
.store(false, std::sync::atomic::Ordering::Relaxed);
}
// Always mark the memo as no longer dirty even if the value didn't change
update_write
.dirty
.store(false, std::sync::atomic::Ordering::Relaxed);
}
/// Get the scope that the signal was created in.
+1
View File
@@ -557,6 +557,7 @@ struct SignalSubscriberDrop<T: 'static, S: Storage<SignalData<T>>> {
#[allow(clippy::no_effect)]
impl<T: 'static, S: Storage<SignalData<T>>> Drop for SignalSubscriberDrop<T, S> {
fn drop(&mut self) {
println!("dropping signal subscriber");
#[cfg(debug_assertions)]
{
tracing::trace!(