@@ -531,36 +531,55 @@ function updateOutput(
531
531
return ;
532
532
}
533
533
534
- const [ outputId , outputProp ] = payload . output . split ( '.' ) ;
535
- const updatedProps = {
536
- [ outputProp ] : returnValue ,
537
- } ;
534
+ function updateOutput ( outputIdAndProp , outputValue ) {
535
+ const [ outputId , outputProp ] = outputIdAndProp . split ( '.' ) ;
536
+ const updatedProps = {
537
+ [ outputProp ] : outputValue ,
538
+ } ;
538
539
539
- /*
540
- * Update the request queue by treating a successful clientside
541
- * like a succesful serverside response (200 status code)
542
- */
543
- updateRequestQueue ( false , STATUS . OK ) ;
540
+ /*
541
+ * Update the request queue by treating a successful clientside
542
+ * like a succesful serverside response (200 status code)
543
+ */
544
+ updateRequestQueue ( false , STATUS . OK ) ;
544
545
545
- // Update the layout with the new result
546
- dispatch (
547
- updateProps ( {
548
- itempath : getState ( ) . paths [ outputId ] ,
549
- props : updatedProps ,
550
- source : 'response' ,
551
- } )
552
- ) ;
546
+ // Update the layout with the new result
547
+ dispatch (
548
+ updateProps ( {
549
+ itempath : getState ( ) . paths [ outputId ] ,
550
+ props : updatedProps ,
551
+ source : 'response' ,
552
+ } )
553
+ ) ;
553
554
554
- /*
555
- * This output could itself be a serverside or clientside input
556
- * to another function
557
- */
558
- dispatch (
559
- notifyObservers ( {
560
- id : outputId ,
561
- props : updatedProps ,
562
- } )
563
- ) ;
555
+ /*
556
+ * This output could itself be a serverside or clientside input
557
+ * to another function
558
+ */
559
+ dispatch (
560
+ notifyObservers ( {
561
+ id : outputId ,
562
+ props : updatedProps ,
563
+ } )
564
+ ) ;
565
+ }
566
+
567
+ if ( payload . output . startsWith ( '..' ) ) {
568
+ /*
569
+ * If this update is for multiple outputs, then it has
570
+ * starting & trailing `..` and each propId pair is separated
571
+ * by `...`, e.g.
572
+ * "..output-1.value...output-2.value...output-3.value...output-4.value.."
573
+ */
574
+ const outputPropIds = payload . output . split ( '...' ) . map (
575
+ o => o . replace ( '..' , '' ) // trim starting & trailing ..
576
+ ) ;
577
+ for ( let i = 0 ; i < outputPropIds . length ; i ++ ) {
578
+ updateOutput ( outputPropIds [ i ] , returnValue [ i ] ) ;
579
+ }
580
+ } else {
581
+ updateOutput ( payload . output , returnValue ) ;
582
+ }
564
583
565
584
/*
566
585
* Note that unlike serverside updates, we're not handling
0 commit comments