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:
parent
6c8764c36a
commit
114a70eebd
2 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue