From dc3b074520f9dc9495243ff08d8474bd01b4b90a Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Wed, 3 Dec 2025 14:04:58 +0530 Subject: [PATCH] fixes: coderabbit --- .../Collection/RemoveCollection/index.js | 4 + .../WorkspaceHome/WorkspaceDocs/index.js | 7 +- .../ImportEnvironment/index.js | 8 +- .../CreateWorkspace/StyledWrapper.js | 5 - .../WorkspaceSidebar/CreateWorkspace/index.js | 121 +++++++++--------- 5 files changed, 73 insertions(+), 72 deletions(-) delete mode 100644 packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/StyledWrapper.js diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/RemoveCollection/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/RemoveCollection/index.js index 5ce0ff3ad..4b5f9a0f4 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/RemoveCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/RemoveCollection/index.js @@ -33,6 +33,10 @@ const RemoveCollection = ({ onClose, collectionUid }) => { .catch(() => toast.error('An error occurred while removing the collection')); }; + if (!collection) { + return
Collection not found
; + } + // If there are drafts, show the draft confirmation modal if (drafts.length > 0) { return ; diff --git a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceDocs/index.js b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceDocs/index.js index 627e7b04e..f676070ca 100644 --- a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceDocs/index.js +++ b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceDocs/index.js @@ -36,6 +36,11 @@ const WorkspaceDocs = ({ workspace }) => { }; const onSave = async () => { + if (!workspace) { + toast.error('Workspace not found'); + return; + } + try { await dispatch(saveWorkspaceDocs(workspace.uid, localDocs)); toast.success('Documentation saved successfully'); @@ -76,7 +81,7 @@ const WorkspaceDocs = ({ workspace }) => { value={localDocs} onEdit={onEdit} onSave={onSave} - mode="application/text" + mode="markdown" font={get(preferences, 'font.codeFont', 'default')} fontSize={get(preferences, 'font.codeFontSize')} /> diff --git a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/ImportEnvironment/index.js b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/ImportEnvironment/index.js index 3e9690fe6..e4f6544d9 100644 --- a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/ImportEnvironment/index.js +++ b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/ImportEnvironment/index.js @@ -14,10 +14,10 @@ const ImportEnvironment = ({ onClose, onEnvironmentCreated }) => { const handleImportPostmanEnvironment = () => { importPostmanEnvironment() .then((environments) => { - environments + const importPromises = environments .filter((env) => env.name && env.name !== 'undefined') - .map((environment) => { + .map((environment) => dispatch(addGlobalEnvironment({ name: environment.name, variables: environment.variables })) .then(() => { toast.success('Environment imported successfully'); @@ -25,8 +25,8 @@ const ImportEnvironment = ({ onClose, onEnvironmentCreated }) => { .catch((error) => { toast.error('An error occurred while importing the environment'); console.error(error); - }); - }); + })); + return Promise.all(importPromises); }) .then(() => { onClose(); diff --git a/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/StyledWrapper.js b/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/StyledWrapper.js deleted file mode 100644 index e49220854..000000000 --- a/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/StyledWrapper.js +++ /dev/null @@ -1,5 +0,0 @@ -import styled from 'styled-components'; - -const Wrapper = styled.div``; - -export default Wrapper; diff --git a/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/index.js b/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/index.js index e328233e0..1d24ac168 100644 --- a/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/index.js +++ b/packages/bruno-app/src/components/WorkspaceSidebar/CreateWorkspace/index.js @@ -8,7 +8,6 @@ import { createWorkspaceAction } from 'providers/ReduxStore/slices/workspaces/ac import { browseDirectory } from 'providers/ReduxStore/slices/collections/actions'; import { multiLineMsg } from 'utils/common/index'; import { formatIpcError } from 'utils/common/error'; -import StyledWrapper from './StyledWrapper'; const CreateWorkspace = ({ onClose }) => { const inputRef = useRef(); @@ -72,75 +71,73 @@ const CreateWorkspace = ({ onClose }) => { }, [inputRef]); return ( - - -
-
-
- + +
+ +
+ + + {formik.touched.workspaceName && formik.errors.workspaceName ? ( +
{formik.errors.workspaceName}
+ ) : null} +
+ +
+ +
- {formik.touched.workspaceName && formik.errors.workspaceName ? ( -
{formik.errors.workspaceName}
- ) : null} +
- -
- -
- - -
- {formik.touched.workspaceLocation && formik.errors.workspaceLocation ? ( -
{formik.errors.workspaceLocation}
- ) : null} -
- -
- - + {formik.touched.workspaceLocation && formik.errors.workspaceLocation ? ( +
{formik.errors.workspaceLocation}
+ ) : null} +
+ +
+ ); };