From 114a70eebd3830375e4582b5ac128a0784710833 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 7 Jul 2025 17:15:54 -0300 Subject: [PATCH] refactor: Update useIsLocalConnection to useCustomIsLocalConnection (#8915) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ (use-custom-is-local-connection.ts): introduce a new hook to check if the current window is being accessed through a local connection ♻️ (McpServerTab.tsx): refactor to use the new useCustomIsLocalConnection hook instead of the deprecated useIsLocalConnection hook --- .../hooks/use-custom-is-local-connection.ts} | 2 +- .../pages/MainPage/pages/homePage/components/McpServerTab.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/frontend/src/{hooks/useIsLocalConnection.ts => customization/hooks/use-custom-is-local-connection.ts} (91%) diff --git a/src/frontend/src/hooks/useIsLocalConnection.ts b/src/frontend/src/customization/hooks/use-custom-is-local-connection.ts similarity index 91% rename from src/frontend/src/hooks/useIsLocalConnection.ts rename to src/frontend/src/customization/hooks/use-custom-is-local-connection.ts index cbbc63194..e42753d06 100644 --- a/src/frontend/src/hooks/useIsLocalConnection.ts +++ b/src/frontend/src/customization/hooks/use-custom-is-local-connection.ts @@ -4,7 +4,7 @@ import { useMemo } from "react"; * Hook to check if the current window is being accessed through a local connection * @returns A boolean indicating if the current connection is local */ -export function useIsLocalConnection(): boolean { +export function useCustomIsLocalConnection(): boolean { return useMemo(() => { // Get the current window's hostname const currentHostname = window.location.hostname; diff --git a/src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx b/src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx index 27adc7701..4d136b6d9 100644 --- a/src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx +++ b/src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx @@ -11,9 +11,9 @@ import { } from "@/controllers/API/queries/mcp"; import { useGetInstalledMCP } from "@/controllers/API/queries/mcp/use-get-installed-mcp"; import { usePatchInstallMCP } from "@/controllers/API/queries/mcp/use-patch-install-mcp"; +import { useCustomIsLocalConnection } from "@/customization/hooks/use-custom-is-local-connection"; import useTheme from "@/customization/hooks/use-custom-theme"; import { customGetMCPUrl } from "@/customization/utils/custom-mcp-url"; -import { useIsLocalConnection } from "@/hooks/useIsLocalConnection"; import useAlertStore from "@/stores/alertStore"; import useAuthStore from "@/stores/authStore"; import { useFolderStore } from "@/stores/foldersStore"; @@ -150,7 +150,7 @@ const McpServerTab = ({ folderName }: { folderName: string }) => { const isAutoLogin = useAuthStore((state) => state.autoLogin); // Check if the current connection is local - const isLocalConnection = useIsLocalConnection(); + const isLocalConnection = useCustomIsLocalConnection(); const [selectedMode, setSelectedMode] = useState( isLocalConnection ? "Auto install" : "JSON",