mirror of https://github.com/sveltejs/svelte
parent
3fe278a8c3
commit
999b8e5ea0
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure legacy props cache last value when destroyed
|
||||
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import { onDestroy } from 'svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
onDestroy(() => {
|
||||
data;
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,10 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
test({ assert, logs, target }) {
|
||||
target.querySelector('button')?.click();
|
||||
flushSync();
|
||||
assert.deepEqual(logs, ['should fire once']);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,17 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let active = true;
|
||||
let data = { example: 'This is some example data' };
|
||||
|
||||
function log(data) {
|
||||
console.log('should fire once');
|
||||
return data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={() => active = false}>Hide</button>
|
||||
|
||||
{#if active}
|
||||
<Child data={log(data)} />
|
||||
{/if}
|
||||
Loading…
Reference in new issue