@@ -15,7 +15,7 @@ import {
1515import { equals , safe_equals } from './equality.js' ;
1616import * as e from '../errors.js' ;
1717import { destroy_effect } from './effects.js' ;
18- import { inspect_effects , old_values , set_inspect_effects } from './sources.js' ;
18+ import { inspect_effects , set_inspect_effects } from './sources.js' ;
1919import { get_stack } from '../dev/tracing.js' ;
2020import { tracing_mode_flag } from '../../flags/index.js' ;
2121import { component_context } from '../context.js' ;
@@ -175,27 +175,6 @@ export function update_derived(derived) {
175175 var value = execute_derived ( derived ) ;
176176
177177 if ( ! derived . equals ( value ) ) {
178- // store old value before updating
179- // so that user_effect teardown functions
180- // can access the previous value.
181- // this is needed because derived updates happen early during
182- // effects dependency resolution (before cleanup),
183- // unlike direct state/derived updates, and this
184- // can happen also during template_effect execution
185- // that also happens before user_effect teardown.
186- //
187- // store old value only if not inside a teardown function
188- // because we only need to save the old values before
189- // the cleanup is triggered othewise accessing
190- // a derived during cleanup will return the incorrect
191- // value in case the derived wasn't in the deps of the effect,
192- // or the teardown was executed because the component was
193- // destroyed.
194- if ( ! is_destroying_effect ) {
195- var old_value = derived . v ;
196- old_values . set ( derived , old_value ) ;
197- }
198-
199178 derived . v = value ;
200179 derived . wv = increment_write_version ( ) ;
201180 }
0 commit comments