Skip to content

Instantly share code, notes, and snippets.

View tyler-dot-earth's full-sized avatar
🗿
living.

Tyler Nieman tyler-dot-earth

🗿
living.
View GitHub Profile
@tyler-dot-earth
tyler-dot-earth / await.tsx
Created April 29, 2025 23:03 — forked from perfectbase/await.tsx
Await component for tRPC with prefetch
/* eslint-disable @typescript-eslint/no-explicit-any */
import { type TRPCQueryOptions } from '@trpc/tanstack-react-query';
import { unstable_noStore } from 'next/cache';
import { Fragment, Suspense, type ReactNode } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { HydrateClient, prefetch as prefetchTRPC } from '@/trpc/server';
type AwaitProps<T> =
| {
promise: Promise<T>;