fixes for workspace with conflicting localstorage

pull/5370/head
filip mertens 2 years ago committed by Aniket
parent 8c3c6200d9
commit 39c56907c4
  1. 1
      apps/remix-ide/src/app/panels/file-panel.js
  2. 3
      libs/remix-ui/workspace/src/lib/actions/index.ts
  3. 12
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -95,6 +95,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
getAvailableWorkspaceName (name) {
if(!this.workspaces) return null
let index = 1
let workspace = this.workspaces.find(workspace => workspace.name === name + ' - ' + index)
while (workspace) {

@ -53,7 +53,6 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
const params = queryParams.get() as UrlParametersType
const workspaces = await getWorkspaces() || []
dispatch(setWorkspaces(workspaces))
// console.log('workspaces: ', workspaces)
if (params.gist) {
await createWorkspaceTemplate('gist-sample', 'gist-template')
plugin.setWorkspace({ name: 'gist-sample', isLocalhost: false })
@ -124,6 +123,8 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
workspaceProvider.setWorkspace(name)
plugin.setWorkspace({ name: name, isLocalhost: false })
dispatch(setCurrentWorkspace({ name: name, isGitRepo: false }))
}else{
await basicWorkspaceInit(workspaces, workspaceProvider)
}
} else {
await basicWorkspaceInit(workspaces, workspaceProvider)

@ -47,9 +47,15 @@ export function Workspace () {
useEffect(() => {
if (global.fs.mode === 'browser') {
if (global.fs.browser.currentWorkspace) setCurrentWorkspace(global.fs.browser.currentWorkspace)
else setCurrentWorkspace(NO_WORKSPACE)
global.dispatchFetchWorkspaceDirectory(ROOT_PATH)
if (global.fs.browser.currentWorkspace) {
setCurrentWorkspace(global.fs.browser.currentWorkspace)
global.dispatchFetchWorkspaceDirectory(ROOT_PATH)
}
else
{
setCurrentWorkspace(NO_WORKSPACE)
}
} else if (global.fs.mode === 'localhost') {
global.dispatchFetchWorkspaceDirectory(ROOT_PATH)
setCurrentWorkspace(LOCALHOST)

Loading…
Cancel
Save