mirror of https://github.com/sveltejs/svelte
fix: ensure all effect cleanup functions are untracked (#11567)
* fix: ensure all effect cleanup functions are untracked * add test --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/11571/head
parent
f6e87772cb
commit
5497b3d0bc
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure all effect cleanup functions are untracked
|
@ -0,0 +1,4 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
// nothing to test here — if the teardown function is not untracked, effect will loop
|
||||||
|
export default test({});
|
@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
let prop = $state();
|
||||||
|
let key = $state({});
|
||||||
|
|
||||||
|
function action() {
|
||||||
|
prop = {};
|
||||||
|
$effect.pre(() => {
|
||||||
|
return () => {
|
||||||
|
prop;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(() => key = {});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#key key}
|
||||||
|
<div use:action>test</div>
|
||||||
|
{/key}
|
Loading…
Reference in new issue