Update comment

pull/16263/head
raythurnvoid 3 months ago
parent 5ed74b24ba
commit b213de2caf

@ -185,8 +185,12 @@ export function update_derived(derived) {
// that also happens before user_effect teardown. // that also happens before user_effect teardown.
// //
// store old value only if not inside a teardown function // store old value only if not inside a teardown function
// because in legacy mode, bindable props are deriveds // because we only need to save the old values before
// and they are executed during teardown. // the cleanup is triggered othewise accessing
// a derived during cleanup will return the incorrect
// value in case the derived wasn't in the deps of the effect,
// or the teardown was executed because the component was
// destroyed.
if (!is_destroying_effect) { if (!is_destroying_effect) {
var old_value = derived.v; var old_value = derived.v;
old_values.set(derived, old_value); old_values.set(derived, old_value);

Loading…
Cancel
Save