From 3ef90763555920702fda6b7430ab05c39a12a09f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 12:55:22 +0530 Subject: [PATCH 1/3] check if remixd activated before switching --- .../workspace/src/lib/remix-ui-workspace.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 1baca04eb7..51516d87f5 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -272,11 +272,13 @@ export const Workspace = (props: WorkspaceProps) => { const remixdExplorer = { hide: async () => { - await setWorkspace(NO_WORKSPACE) - props.fileManager.setMode('browser') - setState(prevState => { - return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } - }) + if (props.fileManager.mode === 'localhost') { + await setWorkspace(NO_WORKSPACE) + props.fileManager.setMode('browser') + setState(prevState => { + return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } + }) + } }, show: () => { props.fileManager.setMode('localhost') From b29c66de726ba0acaf55d45bad80b024be2447b6 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 13:03:05 +0530 Subject: [PATCH 2/3] hide spinner --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 51516d87f5..2774a75cd4 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -278,6 +278,10 @@ export const Workspace = (props: WorkspaceProps) => { setState(prevState => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } }) + } else { + setState(prevState => { + return { ...prevState, loadingLocalhost: false } + }) } }, show: () => { From e92f5acbb4d23e93ef0c0d08e5491bc19fb2e2ce Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 13:55:59 +0530 Subject: [PATCH 3/3] switch to previous workspace from localhost --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 2774a75cd4..f7d9994211 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -91,6 +91,7 @@ export const Workspace = (props: WorkspaceProps) => { const localhostDisconnect = () => { if (state.currentWorkspace === LOCALHOST) setWorkspace(props.workspaces.length > 0 ? props.workspaces[0] : NO_WORKSPACE) + else setWorkspace(state.currentWorkspace) // Useful to switch to last selcted workspace when remixd is disconnected } props.localhost.event.unregister('disconnected', localhostDisconnect) props.localhost.event.register('disconnected', localhostDisconnect) @@ -272,6 +273,7 @@ export const Workspace = (props: WorkspaceProps) => { const remixdExplorer = { hide: async () => { + // If 'connect to localhost' is clicked from home tab, mode is not 'localhost' if (props.fileManager.mode === 'localhost') { await setWorkspace(NO_WORKSPACE) props.fileManager.setMode('browser') @@ -279,6 +281,7 @@ export const Workspace = (props: WorkspaceProps) => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } }) } else { + // Hide spinner in file explorer setState(prevState => { return { ...prevState, loadingLocalhost: false } })