mirror of https://github.com/sveltejs/svelte
Since async-await was introduced into the code base a lot has changed. This lifts the restriction. Closes #17131 (though I still wonder why Skeleton does that)lift-flushsync-restriction
parent
e238e6611e
commit
cf376b4fb9
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
chore: lift "flushSync cannot be called in effects" restriction
|
||||
@ -1,12 +1,8 @@
|
||||
import { async_mode } from '../../../helpers';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
// In legacy mode this succeeds and logs 'hello'
|
||||
// In async mode this throws an error because flushSync is called inside an effect
|
||||
async test({ assert, target, logs }) {
|
||||
assert.htmlEqual(target.innerHTML, `<button>show</button> <div>hello</div>`);
|
||||
assert.deepEqual(logs, ['hello']);
|
||||
},
|
||||
runtime_error: async_mode ? 'flush_sync_in_effect' : undefined
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in new issue