@@ -233,33 +233,34 @@ export class WidgetModel extends Backbone.Model {
233
233
if ( msg . parent_header && data . echo ) {
234
234
const msgId = ( msg . parent_header as any ) . msg_id ;
235
235
// for echoed attributes we ignore old updates
236
- data . echo . forEach ( ( attrName : string ) => {
237
- if ( ! Object . keys ( this . attrLastUpdateMsgId ) . includes ( attrName ) ) {
238
- console . error ( `Kernel send unexpected echo for ${ attrName } .` ) ;
239
- }
240
- // we don't care about the old messages, only the one send with the
241
- // last msgId
242
- const isOldMessage =
243
- this . attrLastUpdateMsgId [ attrName ] !== msgId ;
244
- if ( isOldMessage ) {
245
- // get rid of old updates
246
- delete state [ attrName ] ;
247
- } else {
248
- // we got our confirmation, from now on we accept everything
249
- delete this . attrLastUpdateMsgId [ attrName ] ;
250
- // except, we plan to send out a new state for this soon, so we will
251
- // also ignore the update for this property
252
- if (
253
- this . _msg_buffer !== null &&
254
- Object . prototype . hasOwnProperty . call (
255
- this . _msg_buffer ,
256
- attrName
257
- )
258
- ) {
236
+ data . echo
237
+ . filter ( ( attrName : string ) =>
238
+ Object . keys ( this . attrLastUpdateMsgId ) . includes ( attrName )
239
+ )
240
+ . forEach ( ( attrName : string ) => {
241
+ // we don't care about the old messages, only the one send with the
242
+ // last msgId
243
+ const isOldMessage =
244
+ this . attrLastUpdateMsgId [ attrName ] !== msgId ;
245
+ if ( isOldMessage ) {
246
+ // get rid of old updates
259
247
delete state [ attrName ] ;
248
+ } else {
249
+ // we got our confirmation, from now on we accept everything
250
+ delete this . attrLastUpdateMsgId [ attrName ] ;
251
+ // except, we plan to send out a new state for this soon, so we will
252
+ // also ignore the update for this property
253
+ if (
254
+ this . _msg_buffer !== null &&
255
+ Object . prototype . hasOwnProperty . call (
256
+ this . _msg_buffer ,
257
+ attrName
258
+ )
259
+ ) {
260
+ delete state [ attrName ] ;
261
+ }
260
262
}
261
- }
262
- } ) ;
263
+ } ) ;
263
264
}
264
265
return ( this . constructor as typeof WidgetModel ) . _deserialize_state (
265
266
state ,
0 commit comments