fix: only set `derived.v` outside a fork

failing-test-derived-fork
paoloricciuti 21 hours ago
parent abf408b4ab
commit b671b6679e

@ -358,8 +358,9 @@ export function update_derived(derived) {
// if the derived changes in a fork AND in a subsequent fork/normal state update // if the derived changes in a fork AND in a subsequent fork/normal state update
// IF we are in a tracking context the derived value of the derived will be set // IF we are in a tracking context the derived value of the derived will be set
// in the batch_values map thus updating it for this batch otherwise it will just be updated // in the batch_values map thus updating it for this batch otherwise it will just be updated
// again during the `get` call // again during the `get` call we also prevent setting the value if we are in a fork
if (batch_values === null) { // this will lead to over executing of the derived but would lead to correct values
if (batch_values === null && current_batch?.is_fork !== true) {
derived.v = value; derived.v = value;
} }
derived.wv = increment_write_version(); derived.wv = increment_write_version();

Loading…
Cancel
Save