diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 9af59cce28..c4cc7ca551 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -338,8 +338,10 @@ export const SearchProvider = ({ async function fetchWorkspace() { try { const workspace = await plugin.call('filePanel', 'getCurrentWorkspace') - if (workspace) value.setCurrentWorkspace(workspace.name) - setFiles(await getDirectory('/', plugin)) + if (workspace && workspace.name) { + value.setCurrentWorkspace(workspace.name) + setFiles(await getDirectory('/', plugin)) + } } catch (e) { console.log(e) }