From 73f9d6a65d51aab7ac20899145bd72d07ae78198 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 24 Feb 2021 20:07:27 +0100 Subject: [PATCH] Catch error for inital file loading --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 03ec84888f..a36da6e50d 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -26,8 +26,6 @@ export interface WorkspaceProps { } var canUpload = window.File || window.FileReader || window.FileList || window.Blob - -export const Workspace = (props: WorkspaceProps) => { const LOCALHOST = ' - connect to localhost - ' const NO_WORKSPACE = ' - none - ' @@ -233,12 +231,17 @@ export const Workspace = (props: WorkspaceProps) => { if (error) console.error(error) if (Object.keys(filesList).length === 0) { for (const file in props.examples) { + try { await props.fileManager.writeFile('browser/' + workspacesPath + '/default_workspace/' + props.examples[file].name, props.examples[file].content) + } catch (error) { + console.error(error) + } } setWorkspace('default_workspace') } else { // we've already got some workspaces const workspaces = await getWorkspaces() + if (workspaces.length) setWorkspace(workspaces[0]) else setWorkspace(NO_WORKSPACE) }