mirror of https://github.com/sveltejs/svelte
chore: lift "flushSync cannot be called in effects" restriction (#17139)
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)pull/17228/head
parent
ea8838e96f
commit
84b261886b
@ -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