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