diff --git a/reactive_stores/src/iter.rs b/reactive_stores/src/iter.rs index 84aa7c086..b4c28295b 100644 --- a/reactive_stores/src/iter.rs +++ b/reactive_stores/src/iter.rs @@ -109,6 +109,23 @@ where fn keys(&self) -> Option { self.inner.keys() } + + fn track_field(&self) { + let mut full_path = self.path().into_iter().collect::(); + let trigger = self.get_trigger(self.path().into_iter().collect()); + trigger.this.track(); + trigger.children.track(); + + // tracks `this` for all ancestors: i.e., it will track any change that is made + // directly to one of its ancestors, but not a change made to a *child* of an ancestor + // (which would end up with every subfield tracking its own siblings, because they are + // children of its parent) + while !full_path.is_empty() { + full_path.pop(); + let inner = self.get_trigger(full_path.clone()); + inner.this.track(); + } + } } impl DefinedAt for AtIndex