From ddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 11 Sep 2019 14:17:13 +0200 Subject: feat(Workspaces): Setting to keep all workspaces loaded --- src/features/workspaces/actions.js | 1 + src/features/workspaces/index.js | 1 + src/features/workspaces/store.js | 5 +++++ 3 files changed, 7 insertions(+) (limited to 'src/features') diff --git a/src/features/workspaces/actions.js b/src/features/workspaces/actions.js index a85f8f57f..5b5db422e 100644 --- a/src/features/workspaces/actions.js +++ b/src/features/workspaces/actions.js @@ -21,6 +21,7 @@ export const workspaceActions = createActionsFromDefinitions({ deactivate: {}, toggleWorkspaceDrawer: {}, openWorkspaceSettings: {}, + toggleKeepAllWorkspacesLoadedSetting: {}, }, PropTypes.checkPropTypes); export default workspaceActions; diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js index ad9023b8b..ed3e52096 100644 --- a/src/features/workspaces/index.js +++ b/src/features/workspaces/index.js @@ -5,6 +5,7 @@ import { resetApiRequests } from './api'; const debug = require('debug')('Franz:feature:workspaces'); export const GA_CATEGORY_WORKSPACES = 'Workspaces'; +export const DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED = false; export const workspaceStore = new WorkspacesStore(); diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 4a1f80b4e..7f41cfc88 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js @@ -97,6 +97,7 @@ export default class WorkspacesStore extends FeatureStore { [workspaceActions.update, this._update], [workspaceActions.activate, this._setActiveWorkspace], [workspaceActions.deactivate, this._deactivateActiveWorkspace], + [workspaceActions.toggleKeepAllWorkspacesLoadedSetting, this._toggleKeepAllWorkspacesLoadedSetting], ]); this._allActions = this._freeUserActions.concat(this._premiumUserActions); this._registerActions(this._allActions); @@ -245,6 +246,10 @@ export default class WorkspacesStore extends FeatureStore { await updateWorkspaceRequest.execute(activeWorkspace); }; + _toggleKeepAllWorkspacesLoadedSetting = async () => { + this._updateSettings({ keepAllWorkspacesLoaded: !this.settings.keepAllWorkspacesLoaded }); + }; + // Reactions _setFeatureEnabledReaction = () => { -- cgit v1.2.3-54-g00ecf