This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class WidgetEchoStore extends EventEmitter {
5555 const widgetId = w . getStateKey ( ) ;
5656 // If there's no echo, or the echo still has a widget present, show the *old* widget
5757 // we don't include widgets that have changed for the same reason we don't include new ones,
58- // ie. we'd need to fake matrix events to do so and therte 's currently no need.
58+ // ie. we'd need to fake matrix events to do so and there 's currently no need.
5959 if ( ! roomEchoState [ widgetId ] || Object . keys ( roomEchoState [ widgetId ] ) . length !== 0 ) {
6060 echoedWidgets . push ( w ) ;
6161 }
Original file line number Diff line number Diff line change @@ -122,6 +122,15 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
122122 if ( ! room ) return ;
123123 const roomInfo = this . roomMap . get ( room . roomId ) ;
124124 roomInfo . widgets = [ ] ;
125+
126+ // first clean out old widgets from the map which originate from this room
127+ // otherwise we are out of sync with the rest of the app with stale widget events during removal
128+ Array . from ( this . widgetMap . values ( ) ) . forEach ( app => {
129+ if ( app . roomId === room . roomId ) {
130+ this . widgetMap . delete ( app . id ) ;
131+ }
132+ } ) ;
133+
125134 this . generateApps ( room ) . forEach ( app => {
126135 this . widgetMap . set ( app . id , app ) ;
127136 roomInfo . widgets . push ( app ) ;
You can’t perform that action at this time.
0 commit comments