From b76e32392b43acaa17649e37285ea26890ce0446 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 30 Jul 2025 17:15:55 +0000 Subject: [PATCH 1/6] feat: auto-refresh marketplace data when organization settings change - Added organizationSettingsVersion to ExtensionState type - Modified ClineProvider to include version in state sent to webview - Updated CloudService callback to trigger marketplace refresh on settings change - Added logic to MarketplaceView to detect version changes and request data refresh - Added comprehensive tests for the new functionality This ensures marketplace items (MCPs and modes) stay in sync when organization settings are updated in the cloud. --- src/core/webview/ClineProvider.ts | 16 ++ src/extension.ts | 9 +- src/shared/ExtensionMessage.ts | 1 + .../marketplace/MarketplaceView.tsx | 22 +- .../__tests__/MarketplaceView.spec.tsx | 194 ++++++++++++------ .../src/context/ExtensionStateContext.tsx | 3 + 6 files changed, 183 insertions(+), 62 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 280ab61a061..3f9d1bc6f02 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1617,6 +1617,7 @@ export class ClineProvider cloudIsAuthenticated: cloudIsAuthenticated ?? false, sharingEnabled: sharingEnabled ?? false, organizationAllowList, + organizationSettingsVersion: this.getOrganizationSettingsVersion(), condensingApiConfigId, customCondensingPrompt, codebaseIndexModels: codebaseIndexModels ?? EMBEDDING_MODEL_PROFILES, @@ -1978,4 +1979,19 @@ export class ClineProvider ...gitInfo, } } + + /** + * Get the current organization settings version + */ + private getOrganizationSettingsVersion(): number | undefined { + try { + if (CloudService.hasInstance()) { + const settings = CloudService.instance.getOrganizationSettings() + return settings?.version + } + } catch (error) { + this.log(`Failed to get organization settings version: ${error}`) + } + return undefined + } } diff --git a/src/extension.ts b/src/extension.ts index bd43bcbf8a8..7dfd82c95c6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -76,7 +76,14 @@ export async function activate(context: vscode.ExtensionContext) { // Initialize Roo Code Cloud service. await CloudService.createInstance(context, { - stateChanged: () => ClineProvider.getVisibleInstance()?.postStateToWebview(), + stateChanged: () => { + const provider = ClineProvider.getVisibleInstance() + if (provider) { + provider.postStateToWebview() + // Also refresh marketplace data when organization settings change + provider.fetchMarketplaceData() + } + }, log: cloudLogger, }) diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 67f8782e193..1e562bb9ee3 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -313,6 +313,7 @@ export type ExtensionState = Pick< cloudApiUrl?: string sharingEnabled: boolean organizationAllowList: OrganizationAllowList + organizationSettingsVersion?: number autoCondenseContext: boolean autoCondenseContextPercent: number diff --git a/webview-ui/src/components/marketplace/MarketplaceView.tsx b/webview-ui/src/components/marketplace/MarketplaceView.tsx index b47e1aa875f..538dc756e3f 100644 --- a/webview-ui/src/components/marketplace/MarketplaceView.tsx +++ b/webview-ui/src/components/marketplace/MarketplaceView.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useMemo } from "react" +import { useState, useEffect, useMemo, useContext } from "react" import { Button } from "@/components/ui/button" import { Tab, TabContent, TabHeader } from "../common/Tab" import { MarketplaceViewStateManager } from "./MarketplaceViewStateManager" @@ -8,6 +8,7 @@ import { vscode } from "@/utils/vscode" import { MarketplaceListView } from "./MarketplaceListView" import { cn } from "@/lib/utils" import { TooltipProvider } from "@/components/ui/tooltip" +import { ExtensionStateContext } from "@/context/ExtensionStateContext" interface MarketplaceViewProps { onDone?: () => void @@ -18,6 +19,25 @@ export function MarketplaceView({ stateManager, onDone, targetTab }: Marketplace const { t } = useAppTranslation() const [state, manager] = useStateManager(stateManager) const [hasReceivedInitialState, setHasReceivedInitialState] = useState(false) + const extensionState = useContext(ExtensionStateContext) + const [lastOrganizationSettingsVersion, setLastOrganizationSettingsVersion] = useState( + extensionState?.organizationSettingsVersion, + ) + + // Track when organization settings version changes and trigger refresh + useEffect(() => { + if ( + extensionState?.organizationSettingsVersion !== undefined && + lastOrganizationSettingsVersion !== undefined && + extensionState.organizationSettingsVersion !== lastOrganizationSettingsVersion + ) { + // Organization settings version changed, refresh marketplace data + vscode.postMessage({ + type: "fetchMarketplaceData", + }) + } + setLastOrganizationSettingsVersion(extensionState?.organizationSettingsVersion) + }, [extensionState?.organizationSettingsVersion, lastOrganizationSettingsVersion]) // Track when we receive the initial state useEffect(() => { diff --git a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx index 95b2dea54be..af7e1efd97b 100644 --- a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx +++ b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx @@ -1,87 +1,161 @@ -import { render, screen } from "@/utils/test-utils" -import userEvent from "@testing-library/user-event" - +import { render, waitFor } from "@testing-library/react" +import { vi, describe, it, expect, beforeEach } from "vitest" import { MarketplaceView } from "../MarketplaceView" import { MarketplaceViewStateManager } from "../MarketplaceViewStateManager" +import { ExtensionStateContext } from "@/context/ExtensionStateContext" +import { vscode } from "@/utils/vscode" +// Mock vscode API vi.mock("@/utils/vscode", () => ({ vscode: { postMessage: vi.fn(), - getState: vi.fn(() => ({})), - setState: vi.fn(), }, })) +// Mock the translation hook vi.mock("@/i18n/TranslationContext", () => ({ useAppTranslation: () => ({ t: (key: string) => key, }), })) -vi.mock("../useStateManager", () => ({ - useStateManager: () => [ - { - allItems: [], - displayItems: [], - isFetching: false, - activeTab: "mcp", - filters: { type: "", search: "", tags: [] }, - }, - { - transition: vi.fn(), - onStateChange: vi.fn(() => vi.fn()), - }, - ], -})) - -vi.mock("../MarketplaceListView", () => ({ - MarketplaceListView: ({ filterByType }: { filterByType: string }) => ( -
MarketplaceListView - {filterByType}
- ), -})) - -// Mock Tab components to avoid ExtensionStateContext dependency -vi.mock("@/components/common/Tab", () => ({ - Tab: ({ children, ...props }: any) =>
{children}
, - TabHeader: ({ children, ...props }: any) =>
{children}
, - TabContent: ({ children, ...props }: any) =>
{children}
, - TabList: ({ children, ...props }: any) =>
{children}
, - TabTrigger: ({ children, ...props }: any) => , -})) - describe("MarketplaceView", () => { - const mockOnDone = vi.fn() - const mockStateManager = new MarketplaceViewStateManager() + let stateManager: MarketplaceViewStateManager + let mockExtensionState: any beforeEach(() => { vi.clearAllMocks() + stateManager = new MarketplaceViewStateManager() + + // Initialize state manager with some test data + stateManager.transition({ + type: "FETCH_COMPLETE", + payload: { + items: [ + { + id: "test-mcp", + name: "Test MCP", + type: "mcp" as const, + description: "Test MCP server", + tags: ["test"], + content: "Test content", + url: "https://test.com", + author: "Test Author", + }, + ], + }, + }) + + mockExtensionState = { + organizationSettingsVersion: 1, + // Add other required properties for the context + didHydrateState: true, + showWelcome: false, + theme: {}, + mcpServers: [], + filePaths: [], + openedTabs: [], + commands: [], + organizationAllowList: { allowAll: true, providers: {} }, + cloudIsAuthenticated: false, + sharingEnabled: false, + hasOpenedModeSelector: false, + setHasOpenedModeSelector: vi.fn(), + alwaysAllowFollowupQuestions: false, + setAlwaysAllowFollowupQuestions: vi.fn(), + followupAutoApproveTimeoutMs: 60000, + setFollowupAutoApproveTimeoutMs: vi.fn(), + profileThresholds: {}, + setProfileThresholds: vi.fn(), + // ... other required context properties + } }) - it("renders without crashing", () => { - render() - - expect(screen.getByText("marketplace:title")).toBeInTheDocument() - expect(screen.getByText("marketplace:done")).toBeInTheDocument() - }) - - it("calls onDone when Done button is clicked", async () => { - const user = userEvent.setup() - render() - - await user.click(screen.getByText("marketplace:done")) - expect(mockOnDone).toHaveBeenCalledTimes(1) + it("should trigger fetchMarketplaceData when organization settings version changes", async () => { + const { rerender } = render( + + + , + ) + + // Initial render should not trigger fetch (version hasn't changed) + expect(vscode.postMessage).not.toHaveBeenCalledWith({ + type: "fetchMarketplaceData", + }) + + // Update the organization settings version + mockExtensionState = { + ...mockExtensionState, + organizationSettingsVersion: 2, + } + + // Re-render with updated context + rerender( + + + , + ) + + // Wait for the effect to run + await waitFor(() => { + expect(vscode.postMessage).toHaveBeenCalledWith({ + type: "fetchMarketplaceData", + }) + }) }) - it("renders tab buttons", () => { - render() - - expect(screen.getByText("MCP")).toBeInTheDocument() - expect(screen.getByText("Modes")).toBeInTheDocument() + it("should not trigger fetchMarketplaceData when organization settings version is undefined", async () => { + // Start with undefined version + mockExtensionState = { + ...mockExtensionState, + organizationSettingsVersion: undefined, + } + + const { rerender } = render( + + + , + ) + + // Update to a defined version + mockExtensionState = { + ...mockExtensionState, + organizationSettingsVersion: 1, + } + + rerender( + + + , + ) + + // Should not trigger fetch when transitioning from undefined + await waitFor(() => { + expect(vscode.postMessage).not.toHaveBeenCalledWith({ + type: "fetchMarketplaceData", + }) + }) }) - it("renders MarketplaceListView", () => { - render() - - expect(screen.getByTestId("marketplace-list-view")).toBeInTheDocument() + it("should not trigger fetchMarketplaceData when organization settings version remains the same", async () => { + const { rerender } = render( + + + , + ) + + // Re-render with same version + rerender( + + + , + ) + + // Should not trigger fetch when version hasn't changed + await waitFor(() => { + expect(vscode.postMessage).not.toHaveBeenCalledWith({ + type: "fetchMarketplaceData", + }) + }) }) }) diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index b156d0193b4..1e46caccf48 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -35,6 +35,7 @@ export interface ExtensionStateContextType extends ExtensionState { openedTabs: Array<{ label: string; isActive: boolean; path?: string }> commands: Command[] organizationAllowList: OrganizationAllowList + organizationSettingsVersion?: number cloudIsAuthenticated: boolean sharingEnabled: boolean maxConcurrentFileReads?: number @@ -226,6 +227,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode cloudIsAuthenticated: false, sharingEnabled: false, organizationAllowList: ORGANIZATION_ALLOW_ALL, + organizationSettingsVersion: undefined, autoCondenseContext: true, autoCondenseContextPercent: 100, profileThresholds: {}, @@ -392,6 +394,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode screenshotQuality: state.screenshotQuality, routerModels: extensionRouterModels, cloudIsAuthenticated: state.cloudIsAuthenticated ?? false, + organizationSettingsVersion: state.organizationSettingsVersion, marketplaceItems, marketplaceInstalledMetadata, profileThresholds: state.profileThresholds ?? {}, From 630ad04ac50b0339465e708ec9c6e370e8ad36d5 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 30 Jul 2025 18:29:26 +0000 Subject: [PATCH 2/6] fix: address PR feedback - move organizationSettingsVersion to getState, use -1 instead of undefined, remove fetchMarketplaceData from CloudService callback --- src/core/webview/ClineProvider.ts | 32 +++++++++---------- src/extension.ts | 2 -- .../marketplace/MarketplaceView.tsx | 13 ++++---- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 3f9d1bc6f02..932442934cd 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1505,6 +1505,7 @@ export class ClineProvider cloudIsAuthenticated, sharingEnabled, organizationAllowList, + organizationSettingsVersion, maxConcurrentFileReads, condensingApiConfigId, customCondensingPrompt, @@ -1617,7 +1618,7 @@ export class ClineProvider cloudIsAuthenticated: cloudIsAuthenticated ?? false, sharingEnabled: sharingEnabled ?? false, organizationAllowList, - organizationSettingsVersion: this.getOrganizationSettingsVersion(), + organizationSettingsVersion, condensingApiConfigId, customCondensingPrompt, codebaseIndexModels: codebaseIndexModels ?? EMBEDDING_MODEL_PROFILES, @@ -1704,6 +1705,19 @@ export class ClineProvider ) } + let organizationSettingsVersion: number = -1 + + try { + if (CloudService.hasInstance()) { + const settings = CloudService.instance.getOrganizationSettings() + organizationSettingsVersion = settings?.version ?? -1 + } + } catch (error) { + console.error( + `[getState] failed to get organization settings version: ${error instanceof Error ? error.message : String(error)}`, + ) + } + // Return the same structure as before return { apiConfiguration: providerSettings, @@ -1787,6 +1801,7 @@ export class ClineProvider cloudIsAuthenticated, sharingEnabled, organizationAllowList, + organizationSettingsVersion, // Explicitly add condensing settings condensingApiConfigId: stateValues.condensingApiConfigId, customCondensingPrompt: stateValues.customCondensingPrompt, @@ -1979,19 +1994,4 @@ export class ClineProvider ...gitInfo, } } - - /** - * Get the current organization settings version - */ - private getOrganizationSettingsVersion(): number | undefined { - try { - if (CloudService.hasInstance()) { - const settings = CloudService.instance.getOrganizationSettings() - return settings?.version - } - } catch (error) { - this.log(`Failed to get organization settings version: ${error}`) - } - return undefined - } } diff --git a/src/extension.ts b/src/extension.ts index 7dfd82c95c6..0dffec0e4ce 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -80,8 +80,6 @@ export async function activate(context: vscode.ExtensionContext) { const provider = ClineProvider.getVisibleInstance() if (provider) { provider.postStateToWebview() - // Also refresh marketplace data when organization settings change - provider.fetchMarketplaceData() } }, log: cloudLogger, diff --git a/webview-ui/src/components/marketplace/MarketplaceView.tsx b/webview-ui/src/components/marketplace/MarketplaceView.tsx index 538dc756e3f..a1375b7c749 100644 --- a/webview-ui/src/components/marketplace/MarketplaceView.tsx +++ b/webview-ui/src/components/marketplace/MarketplaceView.tsx @@ -20,23 +20,24 @@ export function MarketplaceView({ stateManager, onDone, targetTab }: Marketplace const [state, manager] = useStateManager(stateManager) const [hasReceivedInitialState, setHasReceivedInitialState] = useState(false) const extensionState = useContext(ExtensionStateContext) - const [lastOrganizationSettingsVersion, setLastOrganizationSettingsVersion] = useState( - extensionState?.organizationSettingsVersion, + const [lastOrganizationSettingsVersion, setLastOrganizationSettingsVersion] = useState( + extensionState?.organizationSettingsVersion ?? -1, ) // Track when organization settings version changes and trigger refresh useEffect(() => { + const currentVersion = extensionState?.organizationSettingsVersion ?? -1 if ( - extensionState?.organizationSettingsVersion !== undefined && - lastOrganizationSettingsVersion !== undefined && - extensionState.organizationSettingsVersion !== lastOrganizationSettingsVersion + currentVersion !== -1 && + lastOrganizationSettingsVersion !== -1 && + currentVersion !== lastOrganizationSettingsVersion ) { // Organization settings version changed, refresh marketplace data vscode.postMessage({ type: "fetchMarketplaceData", }) } - setLastOrganizationSettingsVersion(extensionState?.organizationSettingsVersion) + setLastOrganizationSettingsVersion(currentVersion) }, [extensionState?.organizationSettingsVersion, lastOrganizationSettingsVersion]) // Track when we receive the initial state From d9673ce657c49f379aecd969df6692c0f8326be4 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 30 Jul 2025 18:39:49 +0000 Subject: [PATCH 3/6] refactor: simplify organizationSettingsVersion to use number with -1 default - Change organizationSettingsVersion from number | undefined to number with default -1 - Simplify fetch check in MarketplaceView to just currentVersion !== lastOrganizationSettingsVersion - Update test to verify -1 behavior instead of undefined behavior - All tests pass and TypeScript compilation successful --- .../src/components/marketplace/MarketplaceView.tsx | 6 +----- .../marketplace/__tests__/MarketplaceView.spec.tsx | 13 ++++++++----- webview-ui/src/context/ExtensionStateContext.tsx | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/webview-ui/src/components/marketplace/MarketplaceView.tsx b/webview-ui/src/components/marketplace/MarketplaceView.tsx index a1375b7c749..e8a478d87ed 100644 --- a/webview-ui/src/components/marketplace/MarketplaceView.tsx +++ b/webview-ui/src/components/marketplace/MarketplaceView.tsx @@ -27,11 +27,7 @@ export function MarketplaceView({ stateManager, onDone, targetTab }: Marketplace // Track when organization settings version changes and trigger refresh useEffect(() => { const currentVersion = extensionState?.organizationSettingsVersion ?? -1 - if ( - currentVersion !== -1 && - lastOrganizationSettingsVersion !== -1 && - currentVersion !== lastOrganizationSettingsVersion - ) { + if (currentVersion !== lastOrganizationSettingsVersion) { // Organization settings version changed, refresh marketplace data vscode.postMessage({ type: "fetchMarketplaceData", diff --git a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx index af7e1efd97b..7024c428154 100644 --- a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx +++ b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx @@ -104,11 +104,11 @@ describe("MarketplaceView", () => { }) }) - it("should not trigger fetchMarketplaceData when organization settings version is undefined", async () => { - // Start with undefined version + it("should trigger fetchMarketplaceData when organization settings version changes from -1", async () => { + // Start with -1 version (default) mockExtensionState = { ...mockExtensionState, - organizationSettingsVersion: undefined, + organizationSettingsVersion: -1, } const { rerender } = render( @@ -117,6 +117,9 @@ describe("MarketplaceView", () => { , ) + // Clear any initial calls + vi.clearAllMocks() + // Update to a defined version mockExtensionState = { ...mockExtensionState, @@ -129,9 +132,9 @@ describe("MarketplaceView", () => { , ) - // Should not trigger fetch when transitioning from undefined + // Should trigger fetch when transitioning from -1 to 1 await waitFor(() => { - expect(vscode.postMessage).not.toHaveBeenCalledWith({ + expect(vscode.postMessage).toHaveBeenCalledWith({ type: "fetchMarketplaceData", }) }) diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 1e46caccf48..41a7a93670e 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -35,7 +35,7 @@ export interface ExtensionStateContextType extends ExtensionState { openedTabs: Array<{ label: string; isActive: boolean; path?: string }> commands: Command[] organizationAllowList: OrganizationAllowList - organizationSettingsVersion?: number + organizationSettingsVersion: number cloudIsAuthenticated: boolean sharingEnabled: boolean maxConcurrentFileReads?: number @@ -227,7 +227,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode cloudIsAuthenticated: false, sharingEnabled: false, organizationAllowList: ORGANIZATION_ALLOW_ALL, - organizationSettingsVersion: undefined, + organizationSettingsVersion: -1, autoCondenseContext: true, autoCondenseContextPercent: 100, profileThresholds: {}, @@ -394,7 +394,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode screenshotQuality: state.screenshotQuality, routerModels: extensionRouterModels, cloudIsAuthenticated: state.cloudIsAuthenticated ?? false, - organizationSettingsVersion: state.organizationSettingsVersion, + organizationSettingsVersion: state.organizationSettingsVersion ?? -1, marketplaceItems, marketplaceInstalledMetadata, profileThresholds: state.profileThresholds ?? {}, From d51db1cc6d59046205543ddb862afeba2ee2adb2 Mon Sep 17 00:00:00 2001 From: John Richmond <5629+jr@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:55:12 -0700 Subject: [PATCH 4/6] Fix org mcps not refreshing --- webview-ui/src/components/marketplace/useStateManager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webview-ui/src/components/marketplace/useStateManager.ts b/webview-ui/src/components/marketplace/useStateManager.ts index 697c015cbdc..a1e5a9533cb 100644 --- a/webview-ui/src/components/marketplace/useStateManager.ts +++ b/webview-ui/src/components/marketplace/useStateManager.ts @@ -13,7 +13,10 @@ export function useStateManager(existingManager?: MarketplaceViewStateManager) { prevState.isFetching !== newState.isFetching || prevState.activeTab !== newState.activeTab || JSON.stringify(prevState.allItems) !== JSON.stringify(newState.allItems) || + JSON.stringify(prevState.organizationMcps) !== JSON.stringify(newState.organizationMcps) || JSON.stringify(prevState.displayItems) !== JSON.stringify(newState.displayItems) || + JSON.stringify(prevState.displayOrganizationMcps) !== + JSON.stringify(newState.displayOrganizationMcps) || JSON.stringify(prevState.filters) !== JSON.stringify(newState.filters) return hasChanged ? newState : prevState From 7aca711674d65f4eccd9bc2dea7eefbf46fb061a Mon Sep 17 00:00:00 2001 From: John Richmond <5629+jr@users.noreply.github.com> Date: Wed, 30 Jul 2025 12:57:38 -0700 Subject: [PATCH 5/6] Revert unneeded change --- src/extension.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 0dffec0e4ce..bd43bcbf8a8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -76,12 +76,7 @@ export async function activate(context: vscode.ExtensionContext) { // Initialize Roo Code Cloud service. await CloudService.createInstance(context, { - stateChanged: () => { - const provider = ClineProvider.getVisibleInstance() - if (provider) { - provider.postStateToWebview() - } - }, + stateChanged: () => ClineProvider.getVisibleInstance()?.postStateToWebview(), log: cloudLogger, }) From 8b9cb8ff2f68089433dd5d92c49b17f83ccf674b Mon Sep 17 00:00:00 2001 From: John Richmond <5629+jr@users.noreply.github.com> Date: Wed, 30 Jul 2025 13:00:24 -0700 Subject: [PATCH 6/6] Minor slop reduction pass --- webview-ui/src/components/marketplace/MarketplaceView.tsx | 2 -- .../components/marketplace/__tests__/MarketplaceView.spec.tsx | 2 -- 2 files changed, 4 deletions(-) diff --git a/webview-ui/src/components/marketplace/MarketplaceView.tsx b/webview-ui/src/components/marketplace/MarketplaceView.tsx index e8a478d87ed..abfcf87cc5c 100644 --- a/webview-ui/src/components/marketplace/MarketplaceView.tsx +++ b/webview-ui/src/components/marketplace/MarketplaceView.tsx @@ -24,11 +24,9 @@ export function MarketplaceView({ stateManager, onDone, targetTab }: Marketplace extensionState?.organizationSettingsVersion ?? -1, ) - // Track when organization settings version changes and trigger refresh useEffect(() => { const currentVersion = extensionState?.organizationSettingsVersion ?? -1 if (currentVersion !== lastOrganizationSettingsVersion) { - // Organization settings version changed, refresh marketplace data vscode.postMessage({ type: "fetchMarketplaceData", }) diff --git a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx index 7024c428154..57f7e9eb9d3 100644 --- a/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx +++ b/webview-ui/src/components/marketplace/__tests__/MarketplaceView.spec.tsx @@ -5,14 +5,12 @@ import { MarketplaceViewStateManager } from "../MarketplaceViewStateManager" import { ExtensionStateContext } from "@/context/ExtensionStateContext" import { vscode } from "@/utils/vscode" -// Mock vscode API vi.mock("@/utils/vscode", () => ({ vscode: { postMessage: vi.fn(), }, })) -// Mock the translation hook vi.mock("@/i18n/TranslationContext", () => ({ useAppTranslation: () => ({ t: (key: string) => key,