More memoized requests
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
|
||||
import {
|
||||
@@ -92,7 +94,7 @@ import type {
|
||||
GetSiteConfigRefData,
|
||||
} from "@/types/trpc/routers/contentstack/siteConfig"
|
||||
|
||||
async function getContactConfig(lang: Lang) {
|
||||
const getContactConfig = cache(async (lang: Lang) => {
|
||||
getContactConfigCounter.add(1, { lang })
|
||||
console.info(
|
||||
"contentstack.contactConfig start",
|
||||
@@ -153,7 +155,7 @@ async function getContactConfig(lang: Lang) {
|
||||
JSON.stringify({ query: { lang } })
|
||||
)
|
||||
return validatedContactConfigConfig.data.all_contact_config.items[0]
|
||||
}
|
||||
})
|
||||
|
||||
export const baseQueryRouter = router({
|
||||
contact: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||
|
||||
Reference in New Issue
Block a user