Skip to content

Commit eb9f587

Browse files
committed
fix: access last safe value of prop on unmount
1 parent d3a69c5 commit eb9f587

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/svelte/src/internal/client/runtime.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,17 @@ export function update_effect(effect) {
567567

568568
execute_effect_teardown(effect);
569569
var teardown = update_reaction(effect);
570+
570571
if (typeof teardown === 'function') {
571-
if (effect.ctx !== null && effect.ctx.f === 0) {
572-
effect.ctx.f = CTX_CONTAINS_TEARDOWN;
572+
var ctx = effect.ctx;
573+
if (ctx !== null && ctx.f === 0) {
574+
ctx.f = CTX_CONTAINS_TEARDOWN;
573575
}
574576
effect.teardown = teardown;
575577
} else {
576578
effect.teardown = null;
577579
}
580+
578581
effect.wv = write_version;
579582

580583
var deps = effect.deps;

0 commit comments

Comments
 (0)