diff options
Diffstat (limited to 'app/assets/javascripts/issues/list/graphql.js')
-rw-r--r-- | app/assets/javascripts/issues/list/graphql.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/issues/list/graphql.js b/app/assets/javascripts/issues/list/graphql.js index b590006929a..e64870152bd 100644 --- a/app/assets/javascripts/issues/list/graphql.js +++ b/app/assets/javascripts/issues/list/graphql.js @@ -1,7 +1,9 @@ import produce from 'immer'; -import createDefaultClient from '~/lib/graphql'; +import createDefaultClient, { createApolloClientWithCaching } from '~/lib/graphql'; import getIssuesQuery from 'ee_else_ce/issues/list/queries/get_issues.query.graphql'; +let client; + const resolvers = { Mutation: { reorderIssues: (_, { oldIndex, newIndex, namespace, serializedVariables }, { cache }) => { @@ -22,6 +24,10 @@ const resolvers = { }, }; -export const gqlClient = gon.features?.frontendCaching - ? createDefaultClient(resolvers, { localCacheKey: 'issues_list' }) - : createDefaultClient(resolvers); +export async function gqlClient() { + if (client) return client; + client = gon.features?.frontendCaching + ? await createApolloClientWithCaching(resolvers, { localCacheKey: 'issues_list' }) + : createDefaultClient(resolvers); + return client; +} |