From 575f37124c68177a2d3d33576a3a42f71656cd60 Mon Sep 17 00:00:00 2001 From: naman-bruno Date: Thu, 11 Dec 2025 19:49:27 +0530 Subject: [PATCH] fixes (#6383) --- .../WorkspaceHome/WorkspaceOverview/index.js | 16 +++------------- .../bruno-electron/src/utils/workspace-config.js | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js index d426f7f97..4105157b4 100644 --- a/packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js +++ b/packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.js @@ -1,4 +1,4 @@ -import React, { useState, useMemo } from 'react'; +import React, { useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { IconPlus, IconFolder, IconFileImport } from '@tabler/icons'; import { importCollectionInWorkspace } from 'providers/ReduxStore/slices/workspaces/actions'; @@ -12,24 +12,14 @@ import StyledWrapper from './StyledWrapper'; const WorkspaceOverview = ({ workspace }) => { const dispatch = useDispatch(); - const { collections } = useSelector((state) => state.collections); + const { globalEnvironments } = useSelector((state) => state.globalEnvironments); const [createCollectionModalOpen, setCreateCollectionModalOpen] = useState(false); const [importCollectionModalOpen, setImportCollectionModalOpen] = useState(false); const workspaceCollectionsCount = workspace?.collections?.length || 0; - const workspaceEnvironmentsCount = useMemo(() => { - if (!workspace?.collections || !collections) return 0; - let count = 0; - workspace.collections.forEach((wc) => { - const loadedCollection = collections.find((c) => c.pathname === wc.path); - if (loadedCollection?.environments) { - count += loadedCollection.environments.length; - } - }); - return count; - }, [workspace?.collections, collections]); + const workspaceEnvironmentsCount = globalEnvironments?.length || 0; const handleCreateCollection = async () => { if (!workspace?.pathname) { diff --git a/packages/bruno-electron/src/utils/workspace-config.js b/packages/bruno-electron/src/utils/workspace-config.js index f5c7db34d..a0cf646a4 100644 --- a/packages/bruno-electron/src/utils/workspace-config.js +++ b/packages/bruno-electron/src/utils/workspace-config.js @@ -213,7 +213,7 @@ const addCollectionToWorkspace = async (workspacePath, collection) => { normalizedCollection.remote = collection.remote; } - const existingIndex = config.collections.findIndex((c) => c.name === normalizedCollection.name || c.path === normalizedCollection.path); + const existingIndex = config.collections.findIndex((c) => c.path === normalizedCollection.path); if (existingIndex >= 0) { config.collections[existingIndex] = normalizedCollection;