Skip to content

Commit

Permalink
fix: nested keyed fields in stores (closes #3338) (#3344)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored Dec 12, 2024
1 parent e1e90b8 commit e65969c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion reactive_stores/src/keyed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,15 @@ where
.keys()
.expect("updating keys on a store with no keys");

// generating the latest keys out here means that if we have
// nested keyed fields, the second field will not try to take a
// read-lock on the key map to get the field while the first field
// is still holding the write-lock in the closure below
let latest = self.latest_keys();
keys.with_field_keys(
inner_path,
|keys| {
keys.update(self.latest_keys());
keys.update(latest);
},
|| self.latest_keys(),
);
Expand Down

0 comments on commit e65969c

Please sign in to comment.