refactor: Update useIsLocalConnection to useCustomIsLocalConnection (#8915)

 (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
This commit is contained in:
Cristhian Zanforlin Lousa 2025-07-07 17:15:54 -03:00 committed by GitHub
commit 114a70eebd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -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;

View file

@ -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",