fix: abort and reschedule `$effect.pre` when necessary (#16335)

* unskip failing test

* fix

* tidy up

* skip_no_async

* add comment
pull/16478/head
Rich Harris 2 months ago committed by GitHub
parent 9412c5861c
commit 1deb31082a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,14 +2,18 @@ import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
skip: true,
// For this to work in non-async mode, we would need to abort
// inside `#traverse_effect_tree`, which would be very
// complicated and annoying. Since this hasn't been
// a real issue (AFAICT), we ignore it
skip_no_async: true,
async test({ assert, target, logs }) {
async test({ target }) {
const [open, close] = target.querySelectorAll('button');
flushSync(() => open.click());
flushSync(() => close.click());
assert.deepEqual(logs, [true]);
// if the effect queue isn't aborted after the state change, this will throw
flushSync(() => close.click());
}
});

Loading…
Cancel
Save