fix: significantly reduce unnecessary GraphQL HTTP calls for config information

Also stops calling the heavy ABOUT GraphQL query on HomeView, which does not require the longDescription field.

Fixes #1598
This commit is contained in:
Massedil
2025-06-20 23:58:41 +02:00
parent 1c467099f0
commit 7ceb631518
14 changed files with 69 additions and 369 deletions

View File

@@ -106,7 +106,7 @@
</template>
<script lang="ts" setup>
import { ABOUT } from "@/graphql/config";
import { CONFIG } from "@/graphql/config";
import { IConfig } from "@/types/config.model";
import RouteName from "../router/name";
import { useQuery } from "@vue/apollo-composable";
@@ -117,7 +117,7 @@ import { useHead } from "@/utils/head";
const { currentUser } = useCurrentUserClient();
const { result: configResult } = useQuery<{ config: IConfig }>(ABOUT);
const { result: configResult } = useQuery<{ config: IConfig }>(CONFIG);
const config = computed(() => configResult.value?.config);

View File

@@ -199,7 +199,7 @@ import {
import { useServerProvidedLocation } from "@/composition/apollo/config";
import QuickPublish from "@/components/Home/QuickPublish.vue";
import ShortSearch from "@/components/Home/ShortSearch.vue";
import { ABOUT } from "@/graphql/config";
import { CONFIG } from "@/graphql/config";
import { IConfig } from "@/types/config.model";
import { useI18n } from "vue-i18n";
@@ -214,7 +214,7 @@ const { result: aboutConfigResult } = useQuery<{
IConfig,
"name" | "description" | "slogan" | "registrationsOpen"
>;
}>(ABOUT);
}>(CONFIG);
const config = computed(() => aboutConfigResult.value?.config);

View File

@@ -326,7 +326,7 @@ import {
UNREGISTER_PUSH_MUTATION,
} from "@/graphql/webPush";
import merge from "lodash/merge";
import { WEB_PUSH } from "@/graphql/config";
import { CONFIG } from "@/graphql/config";
import { useMutation, useQuery } from "@vue/apollo-composable";
import {
computed,
@@ -357,7 +357,7 @@ const feedTokens = computed(() =>
const { result: webPushEnabledResult } = useQuery<{
config: Pick<IConfig, "webPush">;
}>(WEB_PUSH);
}>(CONFIG);
const webPushEnabled = computed(
() => webPushEnabledResult.value?.config?.webPush.enabled

View File

@@ -126,7 +126,7 @@
<script setup lang="ts">
import { LOGIN } from "@/graphql/auth";
import { LOGIN_CONFIG } from "@/graphql/config";
import { CONFIG } from "@/graphql/config";
import { LOGGED_USER_LOCATION } from "@/graphql/user";
import { UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user";
import { IConfig } from "@/types/config.model";
@@ -160,7 +160,7 @@ const configQuery = useQuery<{
IConfig,
"auth" | "registrationsOpen" | "registrationsAllowlist"
>;
}>(LOGIN_CONFIG);
}>(CONFIG);
const config = computed(() => configQuery.result.value?.config);