File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
packages/svelte/src/internal/client/reactivity Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -349,15 +349,21 @@ export function render_effect(fn) {
349349 * @param {Array<() => any> } sync
350350 * @param {Array<() => Promise<any>> } async
351351 */
352- export async function template_effect ( fn , sync = [ ] , async = [ ] , d = derived ) {
353- /** @type {Value[] } */
354- const deriveds = sync . map ( d ) ;
355-
352+ export function template_effect ( fn , sync = [ ] , async = [ ] , d = derived ) {
356353 if ( async . length > 0 ) {
357- const async_deriveds = ( await suspend ( Promise . all ( async . map ( async_derived ) ) ) ) . exit ( ) ;
358- deriveds . push ( ...async_deriveds ) ;
354+ suspend ( Promise . all ( async . map ( async_derived ) ) ) . then ( ( result ) => {
355+ create_template_effect ( fn , [ ...sync . map ( d ) , ...result . exit ( ) ] ) ;
356+ } ) ;
357+ } else {
358+ create_template_effect ( fn , sync . map ( d ) ) ;
359359 }
360+ }
360361
362+ /**
363+ * @param {(...expressions: any) => void | (() => void) } fn
364+ * @param {Value[] } deriveds
365+ */
366+ function create_template_effect ( fn , deriveds ) {
361367 const effect = ( ) => fn ( ...deriveds . map ( get ) ) ;
362368
363369 if ( DEV ) {
You can’t perform that action at this time.
0 commit comments