mirror of https://github.com/sveltejs/svelte
Revert "fix: address bug in before/after update" (#9480)
* Revert "fix: address bug in before/after update (#9448)"
This reverts commit 9eb969ddd4
.
* add changeset
pull/9481/head
parent
7e94dee955
commit
60c273eb76
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
revert: address bug in before/after update
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: corrects a beforeUpdate/afterUpdate bug
|
@ -1,7 +0,0 @@
|
||||
<script>
|
||||
const {count, increment} = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={increment}>
|
||||
{count}
|
||||
</button>
|
@ -1,15 +0,0 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: '<button>0</button>',
|
||||
|
||||
async test({ assert, target, component }) {
|
||||
const [btn] = target.querySelectorAll('button');
|
||||
flushSync(() => {
|
||||
btn.click();
|
||||
});
|
||||
assert.deepEqual(component.log, ['beforeUpdate', 'afterUpdate']);
|
||||
assert.htmlEqual(target.innerHTML, `<button>1</button>`);
|
||||
}
|
||||
});
|
@ -1,22 +0,0 @@
|
||||
<script>
|
||||
import Child from './Child.svelte'
|
||||
import {afterUpdate, beforeUpdate} from 'svelte';
|
||||
|
||||
const {log = []} = $props();
|
||||
|
||||
let count = $state(0);
|
||||
|
||||
const increment = () => {
|
||||
count++;
|
||||
}
|
||||
|
||||
beforeUpdate(() => {
|
||||
log.push('beforeUpdate');
|
||||
});
|
||||
|
||||
afterUpdate(() => {
|
||||
log.push('afterUpdate');
|
||||
});
|
||||
</script>
|
||||
|
||||
<Child count={count} increment={increment} />
|
Loading…
Reference in new issue