Skip to content
Back to skills

Lazy Prefetch Pattern

ASecurity

Use the ChatJS React Query v5 lazy-prefetch pattern without blocking server rendering. Use when prefetching tRPC queries in Next.js Server Components or changing query dehydration and hydration behavior in apps/chat.

  • 1,200 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 2, 2026
ai-agentsreactnextjs

Works with

  • cli

Security analysis

A100/100

Scanned September 20, 2026

npx -y skills add FranciscoMoretti/chat-js --skill lazy-prefetch-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lazy Prefetch Pattern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lazy Prefetch Pattern
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/franciscomoretti-lazy-prefetch-pattern-chat-js/badge)](https://www.skillsdirectory.com/skills/franciscomoretti-lazy-prefetch-pattern-chat-js)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: lazy-prefetch-pattern
description: Use the ChatJS React Query v5 lazy-prefetch pattern without blocking server rendering. Use when prefetching tRPC queries in Next.js Server Components or changing query dehydration and hydration behavior in apps/chat.
---

# Lazy prefetch pattern

Start optional server prefetches early without awaiting them so they can stream through React hydration without blocking rendering.

- Use the exported `prefetch()` helper from `@/trpc/server`: `prefetch(trpc.foo.bar.queryOptions(...))`. It handles both paginated and non-paginated queries.
- Await only data required before rendering.
- Render through the existing `HydrateClient` or `HydrationBoundary`.

This depends on `trpc/query-client.ts` dehydrating pending queries and using SuperJSON for serialization and hydration. Preserve those settings when using this pattern.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.