@@ -12,7 +12,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai"
1212import { isOAPProAtom } from "../../../../atoms/oapState"
1313import Tooltip from "../../../../components/Tooltip"
1414import { OAP_ROOT_URL } from "../../../../../shared/oap"
15- import { imgPrefix , oapGetMCPServerConfig , oapGetMCPTags , oapSearchMCPServer } from "../../../../ipc"
15+ import { imgPrefix , oapApplyMCPServer , oapGetMCPTags , oapSearchMCPServer } from "../../../../ipc"
1616import InfoTooltip from "../../../../components/InfoTooltip"
1717import ReactMarkdown from "react-markdown"
1818import rehypeRaw from "rehype-raw"
@@ -24,7 +24,6 @@ import remarkGfm from "remark-gfm"
2424import { showToastAtom } from "../../../../atoms/toastState"
2525import Button from "../../../../components/Button"
2626import { openUrl } from "../../../../ipc/util"
27- import { createPortal } from "react-dom"
2827
2928const SearchHightLight = memo ( ( { text, searchText } : { text : string , searchText : string } ) => {
3029 if ( searchText === "" ) {
@@ -66,7 +65,7 @@ const OAPServerList = ({
6665 onCancel,
6766} : {
6867 oapTools : { id : string , name : string } [ ]
69- onConfirm : ( selectedOap : Array < any > ) => void
68+ onConfirm : ( ) => void
7069 onCancel : ( ) => void
7170} ) => {
7271 const oriOapToolsRef = useRef ( JSON . parse ( JSON . stringify ( oapTools ) ) )
@@ -83,7 +82,6 @@ const OAPServerList = ({
8382 const isInitRef = useRef ( false )
8483 const isFetchingRef = useRef ( true )
8584 const isFetchingNextPageRef = useRef ( false )
86- const [ isLoading , setIsLoading ] = useState ( false )
8785 const [ searchText , setSearchText ] = useState < string > ( "" )
8886 const [ toolList , setToolList ] = useState < ToolItem [ ] > ( [ ] )
8987 const [ sort , setSort ] = useState ( "popular" )
@@ -311,17 +309,14 @@ const OAPServerList = ({
311309 if ( isSubmitting ) {
312310 return
313311 }
314- setHighCostList ( { } )
315312 setIsSubmitting ( true )
316- setIsLoading ( true )
317313 const selectedServers = Array . from (
318314 new Set ( oapTools . map ( tool => tool . id ) )
319315 )
320- const res = await oapGetMCPServerConfig ( selectedServers )
321- await onConfirm ( res ?. data )
322- onCancel ( )
316+ await oapApplyMCPServer ( selectedServers )
323317 setIsSubmitting ( false )
324- setIsLoading ( false )
318+ onConfirm ( )
319+ onCancel ( )
325320 }
326321
327322 const handleBannerUrl = ( url : string ) => {
@@ -733,14 +728,6 @@ const OAPServerList = ({
733728 </ div >
734729 </ PopupConfirm >
735730 }
736-
737- { isLoading && (
738- createPortal (
739- < div className = "global-loading-overlay" >
740- < div className = "loading-spinner" > </ div >
741- </ div > ,
742- document . body
743- ) ) }
744731 </ >
745732 )
746733}
0 commit comments