diff --git a/editor.planx.uk/src/routes/utils.ts b/editor.planx.uk/src/routes/utils.ts index 9822188c8a..615c86efc8 100644 --- a/editor.planx.uk/src/routes/utils.ts +++ b/editor.planx.uk/src/routes/utils.ts @@ -2,7 +2,7 @@ import { TYPES as NodeTypes } from "@planx/components/types"; import gql from "graphql-tag"; import { hasFeatureFlag } from "lib/featureFlags"; import { NaviRequest, NotFoundError } from "navi"; -import pMemoize from "p-memoize"; +// import pMemoize from "p-memoize"; import { useStore } from "pages/FlowEditor/lib/store"; import { ApplicationPath } from "types"; @@ -63,15 +63,17 @@ export const isPreviewOnlyDomain = PREVIEW_ONLY_DOMAINS.some((domain) => window.location.hostname.endsWith(domain), ); +// TODO: is graphql actually caching this without p-memoize? const QUERY_GET_TEAM_BY_DOMAIN = gql` query GetTeamByDomain($domain: String!) { teams(limit: 1, where: { domain: { _eq: $domain } }) { + id slug } } `; -export const getTeamFromDomain = pMemoize(async (domain: string) => { +export const getTeamFromDomain = async (domain: string) => { const { data: { teams }, } = await publicClient.query({ @@ -82,7 +84,7 @@ export const getTeamFromDomain = pMemoize(async (domain: string) => { }); return teams?.[0]?.slug; -}); +}; /** * Prevents accessing a different team than the one associated with the custom domain.