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 { useLump } from "../../mainInput/Lump/LumpContext" ;
38
39
import { useFontSize } from "../../ui/font" ;
@@ -157,6 +158,7 @@ export default function AssistantSelect() {
157
158
const orgs = useAppSelector ( ( store ) => store . profiles . organizations ) ;
158
159
const ideMessenger = useContext ( IdeMessengerContext ) ;
159
160
const { isToolbarExpanded } = useLump ( ) ;
161
+ const [ loading , setLoading ] = useState ( false )
160
162
161
163
const { profiles, session, login } = useAuth ( ) ;
162
164
const navigate = useNavigate ( ) ;
@@ -289,13 +291,15 @@ export default function AssistantSelect() {
289
291
< span > Assistants</ span >
290
292
< div
291
293
className = "flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"
292
- onClick = { ( e ) => {
294
+ onClick = { async ( e ) => {
293
295
e . stopPropagation ( ) ;
294
- refreshProfiles ( ) ;
296
+ setLoading ( true )
297
+ await refreshProfiles ( )
298
+ setLoading ( false )
295
299
buttonRef . current ?. click ( ) ;
296
300
} }
297
301
>
298
- < ArrowPathIcon className = "text-lightgray h-2.5 w-2.5" />
302
+ < ArrowPathIcon className = { cn ( "text-lightgray h-2.5 w-2.5" , loading && 'animate-spin-slow' ) } />
299
303
</ div >
300
304
</ div >
301
305
0 commit comments