Commit d3ac2b1b authored by aniket-engg's avatar aniket-engg Committed by Aniket

switch to previous workspace from localhost

parent 0acf34ba
...@@ -91,6 +91,7 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -91,6 +91,7 @@ export const Workspace = (props: WorkspaceProps) => {
const localhostDisconnect = () => { const localhostDisconnect = () => {
if (state.currentWorkspace === LOCALHOST) setWorkspace(props.workspaces.length > 0 ? props.workspaces[0] : NO_WORKSPACE) 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.unregister('disconnected', localhostDisconnect)
props.localhost.event.register('disconnected', localhostDisconnect) props.localhost.event.register('disconnected', localhostDisconnect)
...@@ -272,6 +273,7 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -272,6 +273,7 @@ export const Workspace = (props: WorkspaceProps) => {
const remixdExplorer = { const remixdExplorer = {
hide: async () => { hide: async () => {
// If 'connect to localhost' is clicked from home tab, mode is not 'localhost'
if (props.fileManager.mode === 'localhost') { if (props.fileManager.mode === 'localhost') {
await setWorkspace(NO_WORKSPACE) await setWorkspace(NO_WORKSPACE)
props.fileManager.setMode('browser') props.fileManager.setMode('browser')
...@@ -279,6 +281,7 @@ export const Workspace = (props: WorkspaceProps) => { ...@@ -279,6 +281,7 @@ export const Workspace = (props: WorkspaceProps) => {
return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false }
}) })
} else { } else {
// Hide spinner in file explorer
setState(prevState => { setState(prevState => {
return { ...prevState, loadingLocalhost: false } return { ...prevState, loadingLocalhost: false }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment