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:
@@ -11,7 +11,7 @@ import {
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import { ANONYMOUS_ACTOR_ID } from "@/graphql/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import { FETCH_EVENT_BASIC, JOIN_EVENT } from "@/graphql/event";
|
||||
import { IEvent } from "@/types/event.model";
|
||||
import { anonymousActorIdMock } from "../../mocks/config";
|
||||
@@ -91,7 +91,7 @@ describe("ParticipationWithoutAccount", () => {
|
||||
...handlers,
|
||||
};
|
||||
mockClient.setRequestHandler(
|
||||
ANONYMOUS_ACTOR_ID,
|
||||
CONFIG,
|
||||
requestHandlers.anonymousActorIdQueryHandler
|
||||
);
|
||||
mockClient.setRequestHandler(
|
||||
|
||||
@@ -4,7 +4,7 @@ import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { DEFAULT_PICTURE } from "@/graphql/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import { getMockClient } from "../../mocks/client";
|
||||
|
||||
let router: Router;
|
||||
@@ -32,7 +32,7 @@ const generateWrapper = (
|
||||
customPostData: Record<string, unknown> = {},
|
||||
customProps: Record<string, unknown> = {}
|
||||
) => {
|
||||
const global_data = getMockClient([DEFAULT_PICTURE]);
|
||||
const global_data = getMockClient([CONFIG]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(PostListItem, {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "mock-apollo-client";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import { loginMock as loginConfigMock } from "../../mocks/config";
|
||||
import { LOGIN_CONFIG } from "@/graphql/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import {
|
||||
loginMock,
|
||||
loginResponseMock,
|
||||
@@ -72,10 +72,7 @@ describe("Render login form", () => {
|
||||
mockhdl: vi.fn().mockResolvedValue(nullMock),
|
||||
...handlers,
|
||||
};
|
||||
mockClient.setRequestHandler(
|
||||
LOGIN_CONFIG,
|
||||
requestHandlers.configQueryHandler
|
||||
);
|
||||
mockClient.setRequestHandler(CONFIG, requestHandlers.configQueryHandler);
|
||||
mockClient.setRequestHandler(LOGIN, requestHandlers.loginMutationHandler);
|
||||
mockClient.setRequestHandler(IDENTITIES, requestHandlers.identity);
|
||||
mockClient.setRequestHandler(LOGGED_USER_LOCATION, requestHandlers.mockhdl);
|
||||
|
||||
@@ -5,14 +5,14 @@ import {
|
||||
createMockIntersectionObserver,
|
||||
getMockClient,
|
||||
} from "../../mocks/client";
|
||||
import { DEFAULT_PICTURE } from "@/graphql/config";
|
||||
import { CONFIG } from "@/graphql/config"; //
|
||||
|
||||
describe("Event Card Story", () => {
|
||||
let wrapper: VueWrapper;
|
||||
|
||||
const generateWrapper = () => {
|
||||
wrapper = mount(EventCardStory, {
|
||||
global: getMockClient([DEFAULT_PICTURE]),
|
||||
global: getMockClient([CONFIG]),
|
||||
});
|
||||
};
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -5,14 +5,14 @@ import {
|
||||
createMockIntersectionObserver,
|
||||
getMockClient,
|
||||
} from "../../mocks/client";
|
||||
import { DEFAULT_PICTURE } from "@/graphql/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
|
||||
describe("Post List Item Story", () => {
|
||||
let wrapper: VueWrapper;
|
||||
|
||||
const generateWrapper = () => {
|
||||
wrapper = mount(PostListItemStory, {
|
||||
global: getMockClient([DEFAULT_PICTURE]),
|
||||
global: getMockClient([CONFIG]),
|
||||
});
|
||||
};
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user