@@ -232,35 +232,35 @@ export class WidgetModel extends Backbone.Model {
232
232
utils . put_buffers ( state , buffer_paths , buffers ) ;
233
233
if ( msg . parent_header && data . echo ) {
234
234
const msgId = ( msg . parent_header as any ) . msg_id ;
235
- // for echoed attributes we ignore old updates
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
235
+ // we may have echos coming from other clients, we only care about
236
+ // dropping echos for which we expected a reply
237
+ const expectedEcho = data . echo . filter ( ( attrName : string ) =>
238
+ Object . keys ( this . attrLastUpdateMsgId ) . includes ( attrName )
239
+ ) ;
240
+ expectedEcho . 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
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
+ ) {
247
260
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
- }
262
261
}
263
- } ) ;
262
+ }
263
+ } ) ;
264
264
}
265
265
return ( this . constructor as typeof WidgetModel ) . _deserialize_state (
266
266
state ,
0 commit comments