ensure metaspace changes correctly notify listeners (#8611)
This commit is contained in:
parent
9b92eca73d
commit
2d386556a6
2 changed files with 29 additions and 0 deletions
|
@ -1072,6 +1072,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
?.["m.room_versions"]?.["org.matrix.msc3244.room_capabilities"]?.["restricted"];
|
||||
});
|
||||
|
||||
const oldMetaSpaces = this._enabledMetaSpaces;
|
||||
const enabledMetaSpaces = SettingsStore.getValue("Spaces.enabledMetaSpaces");
|
||||
this._enabledMetaSpaces = metaSpaceOrder.filter(k => enabledMetaSpaces[k]);
|
||||
|
||||
|
@ -1079,6 +1080,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
this.sendUserProperties();
|
||||
|
||||
this.rebuildSpaceHierarchy(); // trigger an initial update
|
||||
// rebuildSpaceHierarchy will only send an update if the spaces have changed.
|
||||
// If only the meta spaces have changed, we need to send an update ourselves.
|
||||
if (arrayHasDiff(oldMetaSpaces, this._enabledMetaSpaces)) {
|
||||
this.emit(UPDATE_TOP_LEVEL_SPACES, this.spacePanelSpaces, this.enabledMetaSpaces);
|
||||
}
|
||||
|
||||
// restore selected state from last session if any and still valid
|
||||
const lastSpaceId = window.localStorage.getItem(ACTIVE_SPACE_LS_KEY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue