mirror of https://github.com/sveltejs/svelte
The documentation suggested using `$derived(one())` to start promises before awaiting them. This does not eliminate the waterfall: `$derived` is lazy, so `one()` is still only called when `aPromise` is first read, which happens on the `$derived(await aPromise)` line — i.e. sequentially, after the first await completes. Fix: replace `$derived(one())` with `const aPromise = one()` so both functions are called eagerly before either await. Also add a NOTE that this only helps when the promise-creating functions do not themselves read reactive state, and that in the reactive case there is currently no workaround. Closes #16483pull/18743/head
parent
7bc0a70fe6
commit
890d7f8b98
Loading…
Reference in new issue