Improve first loading performance
This commit is contained in:
@ -17,15 +17,12 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
const [, setIsSignInPrefilled] = useRecoilState(isSignInPrefilledState);
|
||||
|
||||
const [, setTelemetry] = useRecoilState(telemetryState);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [setIsLoading] = useState(true);
|
||||
const setSupportChat = useSetRecoilState(supportChatState);
|
||||
|
||||
const { data, loading } = useGetClientConfigQuery();
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
setIsLoading(false);
|
||||
}
|
||||
if (data?.clientConfig) {
|
||||
setAuthProviders({
|
||||
google: data?.clientConfig.authProviders.google,
|
||||
@ -49,5 +46,5 @@ export const ClientConfigProvider: React.FC<React.PropsWithChildren> = ({
|
||||
setSupportChat,
|
||||
]);
|
||||
|
||||
return isLoading ? <></> : <>{children}</>;
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
@ -46,6 +46,7 @@ export const CommandMenu = () => {
|
||||
);
|
||||
|
||||
const { data: peopleData } = useSearchPeopleQuery({
|
||||
skip: !isCommandMenuOpened,
|
||||
variables: {
|
||||
where: {
|
||||
OR: [
|
||||
@ -56,9 +57,11 @@ export const CommandMenu = () => {
|
||||
limit: 3,
|
||||
},
|
||||
});
|
||||
|
||||
const people = peopleData?.searchResults ?? [];
|
||||
|
||||
const { data: companyData } = useSearchCompanyQuery({
|
||||
skip: !isCommandMenuOpened,
|
||||
variables: {
|
||||
where: {
|
||||
OR: [{ name: { contains: search, mode: QueryMode.Insensitive } }],
|
||||
@ -70,6 +73,7 @@ export const CommandMenu = () => {
|
||||
const companies = companyData?.searchResults ?? [];
|
||||
|
||||
const { data: activityData } = useSearchActivityQuery({
|
||||
skip: !isCommandMenuOpened,
|
||||
variables: {
|
||||
where: {
|
||||
OR: [
|
||||
|
||||
Reference in New Issue
Block a user