Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
861 B ยท 27 lines
TypeScript
12345678910111213141516171819202122232425262728import "server-only";import { type AppRouter, appRouter, t } from "@openstatus/api";import type { Context } from "@openstatus/api/src/trpc";import { db } from "@openstatus/db";import { createHydrationHelpers } from "@trpc/react-query/rsc";import { cache } from "react";
import { makeQueryClient } from "./query-client";
const createContextCached = cache( async (..._args: unknown[]): Promise<Context> => { return { req: undefined, db, session: null, }; },);
// IMPORTANT: Create a stable getter for the query client that// will return the same client during the same request.export const getQueryClient = cache(makeQueryClient);const caller = t.createCallerFactory(appRouter)(createContextCached);export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>( caller, getQueryClient,);