diff --git a/web/src/app/admin/assistants/PersonaTable.tsx b/web/src/app/admin/assistants/PersonaTable.tsx index e451a519b497..a28e210c0580 100644 --- a/web/src/app/admin/assistants/PersonaTable.tsx +++ b/web/src/app/admin/assistants/PersonaTable.tsx @@ -41,7 +41,7 @@ function PersonaTypeDisplay({ persona }: { persona: Persona }) { export function PersonasTable() { const router = useRouter(); const { popup, setPopup } = usePopup(); - const { refreshUser, isLoadingUser, isAdmin } = useUser(); + const { refreshUser, isAdmin } = useUser(); const { allAssistants: assistants, refreshAssistants, @@ -98,10 +98,6 @@ export function PersonasTable() { await refreshUser(); }; - if (isLoadingUser) { - return <>; - } - return (
{popup} diff --git a/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx b/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx index 9ff60ebc2238..ae74bb4466c7 100644 --- a/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage.tsx @@ -22,7 +22,7 @@ import { GoogleDriveConfig } from "@/lib/connectors/connectors"; import { useUser } from "@/components/user/UserProvider"; const GDriveMain = ({}: {}) => { - const { isLoadingUser, isAdmin, user } = useUser(); + const { isAdmin, user } = useUser(); const { data: appCredentialData, @@ -63,10 +63,6 @@ const GDriveMain = ({}: {}) => { serviceAccountKeyData || (isServiceAccountKeyError && isServiceAccountKeyError.status === 404); - if (isLoadingUser) { - return <>; - } - if ( (!appCredentialSuccessfullyFetched && isAppCredentialLoading) || (!serviceAccountKeySuccessfullyFetched && isServiceAccountKeyLoading) || diff --git a/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx b/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx index b3120fbefdfd..9db5892ebb00 100644 --- a/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/gmail/GmailPage.tsx @@ -20,7 +20,7 @@ import { GmailConfig } from "@/lib/connectors/connectors"; import { useUser } from "@/components/user/UserProvider"; export const GmailMain = () => { - const { isLoadingUser, isAdmin, user } = useUser(); + const { isAdmin, user } = useUser(); const { data: appCredentialData, @@ -60,10 +60,6 @@ export const GmailMain = () => { serviceAccountKeyData || (isServiceAccountKeyError && isServiceAccountKeyError.status === 404); - if (isLoadingUser) { - return <>; - } - if ( (!appCredentialSuccessfullyFetched && isAppCredentialLoading) || (!serviceAccountKeySuccessfullyFetched && isServiceAccountKeyLoading) || diff --git a/web/src/app/auth/impersonate/page.tsx b/web/src/app/auth/impersonate/page.tsx index 1a2c77d2cdbe..bdc9b37fd2fa 100644 --- a/web/src/app/auth/impersonate/page.tsx +++ b/web/src/app/auth/impersonate/page.tsx @@ -14,13 +14,9 @@ const ImpersonateSchema = Yup.object().shape({ export default function ImpersonatePage() { const router = useRouter(); - const { user, isLoadingUser, isCloudSuperuser } = useUser(); + const { user, isCloudSuperuser } = useUser(); const { popup, setPopup } = usePopup(); - if (isLoadingUser) { - return null; - } - if (!user) { redirect("/auth/login"); } diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 8d59402e3cf8..25b308d3fa3b 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -189,7 +189,7 @@ export function ChatPage({ !shouldShowWelcomeModal ); - const { user, isAdmin, isLoadingUser } = useUser(); + const { user, isAdmin } = useUser(); const slackChatId = searchParams.get("slackChatId"); const existingChatIdRaw = searchParams.get("chatId"); const [sendOnLoad, setSendOnLoad] = useState( @@ -2199,9 +2199,7 @@ export function ChatPage({ /> )} - {documentSidebarInitialWidth !== undefined && - isReady && - !isLoadingUser ? ( + {documentSidebarInitialWidth !== undefined && isReady ? ( {({ getRootProps }) => (
diff --git a/web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx b/web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx index 29b325a42e26..2200eab2f27f 100644 --- a/web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx +++ b/web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx @@ -133,10 +133,7 @@ export const GroupDisplay = ({ const [addConnectorFormVisible, setAddConnectorFormVisible] = useState(false); const [addRateLimitFormVisible, setAddRateLimitFormVisible] = useState(false); - const { isLoadingUser, isAdmin } = useUser(); - if (isLoadingUser) { - return <>; - } + const { isAdmin } = useUser(); const handlePopup = (message: string, type: "success" | "error") => { setPopup({ message, type }); diff --git a/web/src/app/ee/admin/groups/page.tsx b/web/src/app/ee/admin/groups/page.tsx index 8db128ecc7f7..1f3abda92a47 100644 --- a/web/src/app/ee/admin/groups/page.tsx +++ b/web/src/app/ee/admin/groups/page.tsx @@ -35,10 +35,7 @@ const Main = () => { error: usersError, } = useUsers(); - const { isLoadingUser, isAdmin } = useUser(); - if (isLoadingUser) { - return <>; - } + const { isAdmin } = useUser(); if (isLoading || isCCPairsLoading || userIsLoading) { return ; diff --git a/web/src/components/IsPublicGroupSelector.tsx b/web/src/components/IsPublicGroupSelector.tsx index 6cb953f5bdfa..4db2c36860ce 100644 --- a/web/src/components/IsPublicGroupSelector.tsx +++ b/web/src/components/IsPublicGroupSelector.tsx @@ -30,7 +30,7 @@ export const IsPublicGroupSelector = ({ enforceGroupSelection?: boolean; }) => { const { data: userGroups, isLoading: userGroupsIsLoading } = useUserGroups(); - const { isAdmin, user, isLoadingUser, isCurator } = useUser(); + const { isAdmin, user, isCurator } = useUser(); const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled(); const [shouldHideContent, setShouldHideContent] = useState(false); @@ -52,7 +52,7 @@ export const IsPublicGroupSelector = ({ } }, [user, userGroups, isPaidEnterpriseFeaturesEnabled]); - if (isLoadingUser || userGroupsIsLoading) { + if (userGroupsIsLoading) { return
Loading...
; } if (!isPaidEnterpriseFeaturesEnabled) { diff --git a/web/src/components/admin/connectors/AccessTypeForm.tsx b/web/src/components/admin/connectors/AccessTypeForm.tsx index 5950cb6fdc09..33e03a4e5ee4 100644 --- a/web/src/components/admin/connectors/AccessTypeForm.tsx +++ b/web/src/components/admin/connectors/AccessTypeForm.tsx @@ -27,7 +27,7 @@ export function AccessTypeForm({ const isPaidEnterpriseEnabled = usePaidEnterpriseFeaturesEnabled(); const isAutoSyncSupported = isValidAutoSyncSource(connector); - const { isLoadingUser, isAdmin } = useUser(); + const { isAdmin } = useUser(); useEffect(() => { if (!isPaidEnterpriseEnabled) { diff --git a/web/src/components/admin/connectors/AccessTypeGroupSelector.tsx b/web/src/components/admin/connectors/AccessTypeGroupSelector.tsx index 7fbc0b3de1ab..1b3635033e40 100644 --- a/web/src/components/admin/connectors/AccessTypeGroupSelector.tsx +++ b/web/src/components/admin/connectors/AccessTypeGroupSelector.tsx @@ -34,7 +34,7 @@ export function AccessTypeGroupSelector({ connector: ConfigurableSources; }) { const { data: userGroups, isLoading: userGroupsIsLoading } = useUserGroups(); - const { isAdmin, user, isLoadingUser, isCurator } = useUser(); + const { isAdmin, user, isCurator } = useUser(); const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled(); const [shouldHideContent, setShouldHideContent] = useState(false); const isAutoSyncSupported = isValidAutoSyncSource(connector); @@ -77,7 +77,7 @@ export function AccessTypeGroupSelector({ isPaidEnterpriseFeaturesEnabled, ]); - if (isLoadingUser || userGroupsIsLoading) { + if (userGroupsIsLoading) { return
Loading...
; } if (!isPaidEnterpriseFeaturesEnabled) { diff --git a/web/src/components/context/AssistantsContext.tsx b/web/src/components/context/AssistantsContext.tsx index 48c07733ac40..5321affb1404 100644 --- a/web/src/components/context/AssistantsContext.tsx +++ b/web/src/components/context/AssistantsContext.tsx @@ -48,7 +48,7 @@ export const AssistantsProvider: React.FC<{ const [assistants, setAssistants] = useState( initialAssistants || [] ); - const { user, isLoadingUser, isAdmin, isCurator } = useUser(); + const { user, isAdmin, isCurator } = useUser(); const [editablePersonas, setEditablePersonas] = useState([]); const [allAssistants, setAllAssistants] = useState([]); @@ -194,7 +194,7 @@ export const AssistantsProvider: React.FC<{ finalAssistants, ownedButHiddenAssistants, }; - }, [user, assistants, isLoadingUser]); + }, [user, assistants]); return ( ; - } + const { isAdmin } = useUser(); const handleSubmit = async ( values: formType, diff --git a/web/src/components/user/UserProvider.tsx b/web/src/components/user/UserProvider.tsx index 99520f54c750..243f02451dd1 100644 --- a/web/src/components/user/UserProvider.tsx +++ b/web/src/components/user/UserProvider.tsx @@ -7,7 +7,6 @@ import { usePostHog } from "posthog-js/react"; interface UserContextType { user: User | null; - isLoadingUser: boolean; isAdmin: boolean; isCurator: boolean; refreshUser: () => Promise; @@ -25,7 +24,6 @@ export function UserProvider({ user: User | null; }) { const [upToDateUser, setUpToDateUser] = useState(user); - const [isLoadingUser, setIsLoadingUser] = useState(false); const posthog = usePostHog(); @@ -47,13 +45,10 @@ export function UserProvider({ const fetchUser = async () => { try { - setIsLoadingUser(true); const currentUser = await getCurrentUser(); setUpToDateUser(currentUser); } catch (error) { console.error("Error fetching current user:", error); - } finally { - setIsLoadingUser(false); } }; const updateUserAutoScroll = async (autoScroll: boolean | null) => { @@ -95,7 +90,6 @@ export function UserProvider({