@@ -20,6 +20,7 @@ import { useAuth } from "@/lib/auth-context"
2020import { THEMES , useTheme } from "@/lib/theme"
2121import type { InstallationMeta , MyOrgMembership , SavedTokenMeta } from "@/lib/api/types"
2222import { githubWebUrl } from "@/lib/github-web"
23+ import { invalidateInstallations , invalidateTokens } from "@/lib/query-invalidation"
2324
2425
2526function ProfileSection ( ) {
@@ -270,7 +271,7 @@ function ConnectedOrgsSection() {
270271 const [ confirmRow , setConfirmRow ] = useState < ConnectedInstallation | null > ( null )
271272
272273 const personalQuery = useQuery < InstallationMeta [ ] > ( {
273- queryKey : [ "installations" , "me" ] ,
274+ queryKey : [ "installations" ] ,
274275 queryFn : ( ) => api . installations . list ( ) ,
275276 } )
276277 const membershipsQuery = useMyOrgMemberships ( )
@@ -279,7 +280,7 @@ function ConnectedOrgsSection() {
279280 // Only orgs the caller admins -- listForOrg is 403 for a plain member.
280281 const orgInstallQueries = useQueries ( {
281282 queries : adminOrgLogins . map ( ( orgLogin ) => ( {
282- queryKey : [ "installations" , " org", orgLogin ] ,
283+ queryKey : [ "installations. org" , orgLogin ] ,
283284 queryFn : ( ) => api . installations . listForOrg ( orgLogin ) ,
284285 enabled : ! membershipsQuery . isLoading ,
285286 } ) ) ,
@@ -307,7 +308,7 @@ function ConnectedOrgsSection() {
307308 return api . installations . remove ( row . scope === "me" ? { scope : "me" } : { scope : "org" , orgLogin : row . orgLogin } , row . installation_id )
308309 } ,
309310 onSuccess : ( _data , row ) => {
310- queryClient . invalidateQueries ( { queryKey : [ "installations" ] } )
311+ invalidateInstallations ( queryClient )
311312 setConfirmRow ( null )
312313 toast . success ( `Disconnected ${ row . account_login } .` )
313314 } ,
@@ -450,7 +451,7 @@ function SavedTokensSection() {
450451 const upsert = useMutation ( {
451452 mutationFn : ( ) => api . tokens . upsert ( addOrg . trim ( ) , addToken . trim ( ) , addLabel . trim ( ) || undefined ) ,
452453 onSuccess : ( ) => {
453- qc . invalidateQueries ( { queryKey : [ "tokens" ] } )
454+ invalidateTokens ( qc )
454455 setAddOrg ( "" )
455456 setAddToken ( "" )
456457 setAddLabel ( "" )
@@ -476,7 +477,7 @@ function SavedTokensSection() {
476477 next . delete ( org )
477478 return next
478479 } ) ,
479- onSuccess : ( ) => qc . invalidateQueries ( { queryKey : [ "tokens" ] } ) ,
480+ onSuccess : ( ) => invalidateTokens ( qc ) ,
480481 } )
481482
482483 const canAdd = addOrg . trim ( ) . length > 0 && addToken . trim ( ) . length > 0
0 commit comments