@@ -534,29 +534,43 @@ class Template extends TemplateContent {
534534 } ) ;
535535 }
536536
537+ async #renderComputedUnit( entry , data ) {
538+ if ( typeof entry === "string" ) {
539+ return this . renderComputedData ( entry , data ) ;
540+ }
541+
542+ if ( isPlainObject ( entry ) ) {
543+ for ( let key in entry ) {
544+ entry [ key ] = await this . #renderComputedUnit( entry [ key ] , data ) ;
545+ }
546+ }
547+
548+ if ( Array . isArray ( entry ) ) {
549+ for ( let j = 0 , k = entry . length ; j < k ; j ++ ) {
550+ entry [ j ] = await this . #renderComputedUnit( entry [ j ] , data ) ;
551+ }
552+ }
553+
554+ return entry ;
555+ }
556+
537557 _addComputedEntry ( computedData , obj , parentKey , declaredDependencies ) {
538558 // this check must come before isPlainObject
539559 if ( typeof obj === "function" ) {
540560 computedData . add ( parentKey , obj , declaredDependencies ) ;
541- } else if ( Array . isArray ( obj ) ) {
542- // Arrays are treated as one entry in the dependency graph now
561+ } else if ( Array . isArray ( obj ) || typeof obj === "string" ) {
562+ // Arrays are treated as one entry in the dependency graph now, Issue #3728
543563 computedData . addTemplateString (
544564 parentKey ,
545565 async function ( innerData ) {
546- return Promise . all (
547- obj . map ( ( entry ) => {
548- if ( typeof entry === "string" ) {
549- return this . tmpl . renderComputedData ( entry , innerData ) ;
550- }
551- return entry ;
552- } ) ,
553- ) ;
566+ return this . tmpl . #renderComputedUnit( obj , innerData ) ;
554567 } ,
555568 declaredDependencies ,
556569 this . getParseForSymbolsFunction ( obj ) ,
557570 this ,
558571 ) ;
559572 } else if ( isPlainObject ( obj ) ) {
573+ // Arrays used to be computed here
560574 for ( let key in obj ) {
561575 let keys = [ ] ;
562576 if ( parentKey ) {
@@ -565,16 +579,6 @@ class Template extends TemplateContent {
565579 keys . push ( key ) ;
566580 this . _addComputedEntry ( computedData , obj [ key ] , keys . join ( "." ) , declaredDependencies ) ;
567581 }
568- } else if ( typeof obj === "string" ) {
569- computedData . addTemplateString (
570- parentKey ,
571- async function ( innerData ) {
572- return this . tmpl . renderComputedData ( obj , innerData ) ;
573- } ,
574- declaredDependencies ,
575- this . getParseForSymbolsFunction ( obj ) ,
576- this ,
577- ) ;
578582 } else {
579583 // Numbers, booleans, etc
580584 computedData . add ( parentKey , obj , declaredDependencies ) ;
0 commit comments