
discord-questions.trpc.io/m/1304660574080204913
Preview meta tags from the discord-questions.trpc.io website.
Linked Hostnames
4- 3 links todiscord-questions.trpc.io
- 1 link todiscord.com
- 1 link todiscord.gg
- 1 link towww.answeroverflow.com
Thumbnail
Search Engine Appearance
How can I automatically use react's cache with tRPC on server side? - tRPC
I have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
Bing
How can I automatically use react's cache with tRPC on server side? - tRPC
I have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
DuckDuckGo

How can I automatically use react's cache with tRPC on server side? - tRPC
I have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
General Meta Tags
6- titleHow can I automatically use react's cache with tRPC on server side? - tRPC
- charsetutf-8
- viewportwidth=device-width, initial-scale=1
- next-size-adjust
- descriptionI have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
Open Graph Meta Tags
3- og:titleHow can I automatically use react's cache with tRPC on server side? - tRPC
- og:descriptionI have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
- og:imagehttps://discord-questions.trpc.io/og/post?id=1304660574080204913
Twitter Meta Tags
4- twitter:cardsummary_large_image
- twitter:titleHow can I automatically use react's cache with tRPC on server side? - tRPC
- twitter:descriptionI have this in my repo: ```ts import { cache } from "react"; import { headers } from "next/headers"; import { createCaller, createTRPCContext } from "@kdx/api"; import { auth } from "@kdx/auth"; /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a tRPC call from a React Server Component. */ const createContext = cache(async () => { const heads = new Headers(headers()); heads.set("x-trpc-source", "rsc"); return createTRPCContext({ auth: await auth(), headers: heads, }); }); export const api = createCaller(createContext); ``` But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache? I of course could do something like this ```ts export const uglyGetNotifications = cache(api.user.getNotifications); ``` But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like ```ts const notifs = await apiCached.user.getNotifications(); ```
- twitter:imagehttps://discord-questions.trpc.io/og/post?id=1304660574080204913
Link Tags
8- canonicalhttps://discord-questions.trpc.io/m/1304660574080204913
- iconhttps://cdn.answeroverflow.com/867764511159091230/6af104c7f0f39a12fcd55bd7bd28928f/icon.png
- preloadhttps://www.answeroverflow.com/_next/static/media/4f05ba3a6752a328-s.p.woff2
- preloadhttps://www.answeroverflow.com/_next/static/media/9cf9c6e84ed13b5e-s.p.woff2
- preload/discord/3.png
Links
6- https://discord-questions.trpc.io
- https://discord-questions.trpc.io/search
- https://discord-questions.trpc.io/u/208752229815943170
- https://discord.com/channels/867764511159091230/1304660574080204913/1304660574080204913
- https://discord.gg/bvFvwRGW74