Cache value of feature_spaces* flags as they cause page refresh so are immutable

This commit is contained in:
Michael Telatynski 2021-07-15 08:26:49 +01:00
parent 8de4f092d4
commit 90d380c8ae
22 changed files with 82 additions and 68 deletions

View file

@ -19,7 +19,6 @@ import { Room } from "matrix-js-sdk/src/models/room";
import { RoomListStoreClass } from "./RoomListStore";
import { SpaceFilterCondition } from "./filters/SpaceFilterCondition";
import SpaceStore, { UPDATE_SELECTED_SPACE } from "../SpaceStore";
import SettingsStore from "../../settings/SettingsStore";
/**
* Watches for changes in spaces to manage the filter on the provided RoomListStore
@ -29,7 +28,7 @@ export class SpaceWatcher {
private activeSpace: Room = SpaceStore.instance.activeSpace;
constructor(private store: RoomListStoreClass) {
if (!SettingsStore.getValue("feature_spaces.all_rooms")) {
if (!SpaceStore.spacesTweakAllRoomsEnabled) {
this.filter = new SpaceFilterCondition();
this.updateFilter();
store.addFilter(this.filter);
@ -41,7 +40,7 @@ export class SpaceWatcher {
this.activeSpace = activeSpace;
if (this.filter) {
if (activeSpace || !SettingsStore.getValue("feature_spaces.all_rooms")) {
if (activeSpace || !SpaceStore.spacesTweakAllRoomsEnabled) {
this.updateFilter();
} else {
this.store.removeFilter(this.filter);