♻️(frontend) rename isLoading to isConfigLoading for clarity

Rename generic "isLoading" variable to more specific "isConfigLoading" to
accurately reflect its purpose. Improves code readability by making state
variable names more explicit.
This commit is contained in:
lebaudantoine
2025-04-22 22:56:46 +02:00
committed by aleb_the_flash
parent 8e0e286bc4
commit 7f0e866eac

View File

@@ -24,24 +24,25 @@ export const useUser = (
fetchUserOptions?: Parameters<typeof fetchUser>[0]
} = {}
) => {
const { data, isLoading } = useConfig()
const { data, isLoading: isConfigLoading } = useConfig()
const options = useMemo(() => {
if (!data || data?.is_silent_login_enabled !== true) {
if (isConfigLoading) return
if (data?.is_silent_login_enabled !== true) {
return {
...opts,
attemptSilent: false,
}
}
return opts.fetchUserOptions
}, [data, opts])
}, [data, opts, isConfigLoading])
const query = useQuery({
// eslint-disable-next-line @tanstack/query/exhaustive-deps
queryKey: [keys.user],
queryFn: () => fetchUser(options),
staleTime: Infinity,
enabled: !isLoading,
enabled: !isConfigLoading,
})
useEffect(() => {