From d0bad11661cb93756891e7fafe729b7f4e415fb1 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Wed, 1 Sep 2021 09:29:49 +0530 Subject: Fix issue with workspace feature - fixes #1682 (#1854) * fix issue with workspace feature not being turned on, and then randomly turning on somehow. * when deleting the active workspace, auto-select the default workspace. * consolidated the toggling of features into a single place in the config file. Co-authored-by: Sadetdin EYILI Signed-off-by: Vijay A --- src/features/workspaces/store.js | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'src/features/workspaces/store.js') diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 8c73516bc..ec9d7ee7f 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js @@ -155,38 +155,26 @@ export default class WorkspacesStore extends FeatureStore { }; @action _create = async ({ name }) => { - // eslint-disable-next-line no-useless-catch - try { - const workspace = await createWorkspaceRequest.execute(name); - await getUserWorkspacesRequest.result.push(workspace); - this._edit({ workspace }); - } catch (error) { - throw error; - } + const workspace = await createWorkspaceRequest.execute(name); + await getUserWorkspacesRequest.result.push(workspace); + this._edit({ workspace }); }; @action _delete = async ({ workspace }) => { - // eslint-disable-next-line no-useless-catch - try { - await deleteWorkspaceRequest.execute(workspace); - await getUserWorkspacesRequest.result.remove(workspace); - this.stores.router.push('/settings/workspaces'); - } catch (error) { - throw error; + await deleteWorkspaceRequest.execute(workspace); + await getUserWorkspacesRequest.result.remove(workspace); + this.stores.router.push('/settings/workspaces'); + if (this.activeWorkspace === workspace) { + this._deactivateActiveWorkspace(); } }; @action _update = async ({ workspace }) => { - // eslint-disable-next-line no-useless-catch - try { - await updateWorkspaceRequest.execute(workspace); - // Path local result optimistically - const localWorkspace = this._getWorkspaceById(workspace.id); - Object.assign(localWorkspace, workspace); - this.stores.router.push('/settings/workspaces'); - } catch (error) { - throw error; - } + await updateWorkspaceRequest.execute(workspace); + // Path local result optimistically + const localWorkspace = this._getWorkspaceById(workspace.id); + Object.assign(localWorkspace, workspace); + this.stores.router.push('/settings/workspaces'); }; @action _setActiveWorkspace = ({ workspace }) => { -- cgit v1.2.3-54-g00ecf