diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 893ec084f9..5628425b34 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -209,11 +209,13 @@ module.exports = class Filepanel extends ViewPlugin { workspaceProvider.setWorkspace(workspaceName) await this.request.setWorkspace(workspaceName) // tells the react component to switch to that workspace for (const file in examples) { - try { - await workspaceProvider.set(examples[file].name, examples[file].content) - } catch (error) { - console.error(error) - } + setTimeout(async () => { // space creation of files to give react ui time to update. + try { + await workspaceProvider.set(examples[file].name, examples[file].content) + } catch (error) { + console.error(error) + } + }, 200) } } } diff --git a/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts b/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts index eb0303e45d..c9b00bb099 100644 --- a/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts +++ b/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts @@ -182,7 +182,7 @@ export const fileRenamedSuccess = (path: string, removePath: string, files) => { export const init = (provider, workspaceName: string, plugin, registry) => (dispatch: React.Dispatch) => { if (provider) { provider.event.register('fileAdded', async (filePath) => { - const path = extractParentFromKey(filePath) || workspaceName + const path = extractParentFromKey(filePath) ? extractParentFromKey(filePath) === '/.workspaces' ? workspaceName : extractParentFromKey(filePath) : workspaceName const data = await fetchDirectoryContent(provider, path) dispatch(fileAddedSuccess(path, data)) @@ -191,7 +191,7 @@ export const init = (provider, workspaceName: string, plugin, registry) => (disp } }) provider.event.register('folderAdded', async (folderPath) => { - const path = extractParentFromKey(folderPath) || workspaceName + const path = extractParentFromKey(folderPath) ? extractParentFromKey(folderPath) === '/.workspaces' ? workspaceName : extractParentFromKey(folderPath) : workspaceName const data = await fetchDirectoryContent(provider, path) dispatch(folderAddedSuccess(path, data))