File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) {
211211 const { data : generalSettings } = useGeneralSettings ( )
212212 const { data : subscriptionData } = useSubscriptionData ( { enabled : isBillingEnabled } )
213213 const { data : ssoProvidersData , isLoading : isLoadingSSO } = useSSOProviders ( )
214- const { data : superUserData } = useSuperUserStatus ( Boolean ( session ?. user ?. id ) )
214+ const { data : superUserData } = useSuperUserStatus ( session ?. user ?. id )
215215
216216 const activeOrganization = organizationsData ?. activeOrganization
217217 const { config : permissionConfig } = usePermissionConfig ( )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const logger = createLogger('UserProfileQuery')
99export const userProfileKeys = {
1010 all : [ 'userProfile' ] as const ,
1111 profile : ( ) => [ ...userProfileKeys . all , 'profile' ] as const ,
12- superUser : ( ) => [ ...userProfileKeys . all , 'superUser' ] as const ,
12+ superUser : ( userId ?: string ) => [ ...userProfileKeys . all , 'superUser' , userId ?? ' '] as const ,
1313}
1414
1515/**
@@ -134,13 +134,13 @@ async function fetchSuperUserStatus(): Promise<SuperUserStatus> {
134134
135135/**
136136 * Hook to fetch superuser status
137+ * @param userId - User ID for cache isolation (required for proper per-user caching)
137138 */
138- export function useSuperUserStatus ( enabled = true ) {
139+ export function useSuperUserStatus ( userId ?: string ) {
139140 return useQuery ( {
140- queryKey : userProfileKeys . superUser ( ) ,
141+ queryKey : userProfileKeys . superUser ( userId ) ,
141142 queryFn : fetchSuperUserStatus ,
142- enabled,
143+ enabled : Boolean ( userId ) ,
143144 staleTime : 5 * 60 * 1000 , // 5 minutes - superuser status rarely changes
144- placeholderData : keepPreviousData ,
145145 } )
146146}
You can’t perform that action at this time.
0 commit comments