7
7
ExclamationTriangleIcon ,
8
8
PlusIcon ,
9
9
} from "@heroicons/react/24/outline" ;
10
- import { useContext , useEffect , useMemo , useRef } from "react" ;
10
+ import { useContext , useEffect , useMemo , useRef , useState } from "react" ;
11
11
import { useAuth } from "../../../context/Auth" ;
12
12
import { IdeMessengerContext } from "../../../context/IdeMessenger" ;
13
13
import {
@@ -33,6 +33,7 @@ import {
33
33
import { ProfileDescription } from "core/config/ConfigHandler" ;
34
34
import { useNavigate } from "react-router-dom" ;
35
35
import { vscCommandCenterInactiveBorder } from "../.." ;
36
+ import { cn } from "../../../util/cn" ;
36
37
import { ROUTES } from "../../../util/navigation" ;
37
38
import { ToolTip } from "../../gui/Tooltip" ;
38
39
import { useLump } from "../../mainInput/Lump/LumpContext" ;
@@ -165,6 +166,7 @@ export default function AssistantSelect() {
165
166
const orgs = useAppSelector ( ( store ) => store . profiles . organizations ) ;
166
167
const ideMessenger = useContext ( IdeMessengerContext ) ;
167
168
const { isToolbarExpanded } = useLump ( ) ;
169
+ const [ loading , setLoading ] = useState ( false )
168
170
169
171
const { profiles, session, login } = useAuth ( ) ;
170
172
const navigate = useNavigate ( ) ;
@@ -297,13 +299,15 @@ export default function AssistantSelect() {
297
299
< span > Assistants</ span >
298
300
< div
299
301
className = "flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"
300
- onClick = { ( e ) => {
302
+ onClick = { async ( e ) => {
301
303
e . stopPropagation ( ) ;
302
- refreshProfiles ( ) ;
304
+ setLoading ( true )
305
+ await refreshProfiles ( )
306
+ setLoading ( false )
303
307
buttonRef . current ?. click ( ) ;
304
308
} }
305
309
>
306
- < ArrowPathIcon className = "text-lightgray h-2.5 w-2.5" />
310
+ < ArrowPathIcon className = { cn ( "text-lightgray h-2.5 w-2.5" , loading && 'animate-spin' ) } />
307
311
</ div >
308
312
</ div >
309
313
0 commit comments