@@ -87,7 +87,7 @@ class _TextAndGraphicUpdateOperation extends _Task {
8787 this . _fullShow = this . _assembleLayout ( this . _fullShow ) ;
8888
8989 if ( this . _showRpcSupportsTemplateConfiguration ( ) ) {
90- this . _updateGraphicsAndShow ( this . _fullShow ) ;
90+ await this . _updateGraphicsAndShow ( this . _fullShow ) ;
9191 } else {
9292 if ( this . _shouldUpdateTemplateConfig ( ) ) {
9393 const success = await this . _sendSetDisplayLayoutWithTemplateConfiguration ( this . _updatedState . getTemplateConfiguration ( ) ) ;
@@ -96,9 +96,9 @@ class _TextAndGraphicUpdateOperation extends _Task {
9696 this . _finishOperation ( false ) ;
9797 return ;
9898 }
99- this . _updateGraphicsAndShow ( this . _fullShow ) ;
99+ await this . _updateGraphicsAndShow ( this . _fullShow ) ;
100100 } else {
101- this . _updateGraphicsAndShow ( this . _fullShow ) ;
101+ await this . _updateGraphicsAndShow ( this . _fullShow ) ;
102102 }
103103 }
104104 }
@@ -146,7 +146,7 @@ class _TextAndGraphicUpdateOperation extends _Task {
146146 } else {
147147 console . info ( 'Text and Graphic Show failed' ) ;
148148 this . _currentScreenDataUpdateListener ( async ( ) => {
149- throw new Error ( 'Text and Graphic Show failed' ) ;
149+ throw this . _updatedState ; // send the errored state back to the manager
150150 } ) ;
151151 }
152152 return response . getSuccess ( ) ;
@@ -860,6 +860,59 @@ class _TextAndGraphicUpdateOperation extends _Task {
860860 }
861861 this . onFinished ( ) ;
862862 }
863+
864+ /**
865+ * Applies changes to the _TextAndGraphicState with that of the error state
866+ * @private
867+ * @param {_TextAndGraphicState } errorState - The _TextAndGraphicState when the error occured
868+ */
869+ _updateTargetStateWithErrorState ( errorState ) {
870+ if ( errorState . getTextField1 ( ) === this . _updatedState . getTextField1 ( ) ) {
871+ this . _updatedState . setTextField1 ( this . _currentScreenData . getTextField1 ( ) ) ;
872+ }
873+ if ( errorState . getTextField2 ( ) === this . _updatedState . getTextField2 ( ) ) {
874+ this . _updatedState . setTextField2 ( this . _currentScreenData . getTextField2 ( ) ) ;
875+ }
876+ if ( errorState . getTextField3 ( ) === this . _updatedState . getTextField3 ( ) ) {
877+ this . _updatedState . setTextField3 ( this . _currentScreenData . getTextField3 ( ) ) ;
878+ }
879+ if ( errorState . getTextField4 ( ) === this . _updatedState . getTextField4 ( ) ) {
880+ this . _updatedState . setTextField4 ( this . _currentScreenData . getTextField4 ( ) ) ;
881+ }
882+ if ( errorState . getMediaTrackTextField ( ) === this . _updatedState . getMediaTrackTextField ( ) ) {
883+ this . _updatedState . setMediaTrackTextField ( this . _currentScreenData . getMediaTrackTextField ( ) ) ;
884+ }
885+ if ( errorState . getTitle ( ) === this . _updatedState . getTitle ( ) ) {
886+ this . _updatedState . setTitle ( this . _currentScreenData . getTitle ( ) ) ;
887+ }
888+ if ( ( errorState . getPrimaryGraphic ( ) === null && this . _updatedState . getPrimaryGraphic ( ) === null )
889+ || ( errorState . getPrimaryGraphic ( ) !== null && errorState . getPrimaryGraphic ( ) . equals ( this . _updatedState . getPrimaryGraphic ( ) ) ) ) { // for safe null check
890+ this . _updatedState . setPrimaryGraphic ( this . _currentScreenData . getPrimaryGraphic ( ) ) ;
891+ }
892+ if ( ( errorState . getSecondaryGraphic ( ) === null && this . _updatedState . getSecondaryGraphic ( ) === null )
893+ || ( errorState . getSecondaryGraphic ( ) !== null && errorState . getSecondaryGraphic ( ) . equals ( this . _updatedState . getSecondaryGraphic ( ) ) ) ) { // for safe null check
894+ this . _updatedState . setSecondaryGraphic ( this . _currentScreenData . getSecondaryGraphic ( ) ) ;
895+ }
896+ if ( errorState . getTextAlignment ( ) === this . _updatedState . getTextAlignment ( ) ) {
897+ this . _updatedState . setTextAlignment ( this . _currentScreenData . getTextAlignment ( ) ) ;
898+ }
899+ if ( errorState . getTextField1Type ( ) === this . _updatedState . getTextField1Type ( ) ) {
900+ this . _updatedState . setTextField1Type ( this . _currentScreenData . getTextField1Type ( ) ) ;
901+ }
902+ if ( errorState . getTextField2Type ( ) === this . _updatedState . getTextField2Type ( ) ) {
903+ this . _updatedState . setTextField2Type ( this . _currentScreenData . getTextField2Type ( ) ) ;
904+ }
905+ if ( errorState . getTextField3Type ( ) === this . _updatedState . getTextField3Type ( ) ) {
906+ this . _updatedState . setTextField3Type ( this . _currentScreenData . getTextField3Type ( ) ) ;
907+ }
908+ if ( errorState . getTextField4Type ( ) === this . _updatedState . getTextField4Type ( ) ) {
909+ this . _updatedState . setTextField4Type ( this . _currentScreenData . getTextField4Type ( ) ) ;
910+ }
911+ if ( ( errorState . getTemplateConfiguration ( ) === null && this . _updatedState . getTemplateConfiguration ( ) === null )
912+ || ( errorState . getTemplateConfiguration ( ) !== null && errorState . getTemplateConfiguration ( ) . getParameters ( ) === this . _updatedState . getTemplateConfiguration ( ) . getParameters ( ) ) ) { // for safe null check
913+ this . _updatedState . setTemplateConfiguration ( this . _currentScreenData . getTemplateConfiguration ( ) ) ;
914+ }
915+ }
863916}
864917
865918export { _TextAndGraphicUpdateOperation } ;
0 commit comments