Skip to main content

nextbase-cache-components

Use for NextBase Cache Components, Partial Prefetching, use cache, React request memoization, Suspense placement, route prerendering, or separating shared cached data from personalized Supabase data.

来源信息

仓库
imbhargav5/nextbase-nextjs-supabase-starter
最近来源活动
2026年9月1日 00:20
检测到的 SKILL.md 语言
英语
星标
827
分支
215

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
nextbase-cache-components
description
Use for NextBase Cache Components, Partial Prefetching, use cache, React request memoization, Suspense placement, route prerendering, or separating shared cached data from personalized Supabase data.
# NextBase Cache Components Load `next-cache-components-optimizer` for current Next.js mechanics and `vercel-react-best-practices` for React performance guidance. This project enables `cacheComponents` and `partialPrefetching` in `apps/web/next.config.ts`. ## Classify Data First - Shared, public, deterministic data may be persisted with `'use cache'` when it does not read cookies, headers, session state, or user-specific inputs. - Personalized or authorization-sensitive data must stay dynamic and must not enter a shared cache scope. - React `cache()` in `src/rsc-data` deduplicates work during one server render. It is not a persistent cross-request cache. Never create an anonymous Supabase client merely to make personalized data cacheable. A different client does not change the data's privacy classification. ## Composition Pattern 1. Keep the route shell and shared headings cacheable when safe. 2. Move cookie, claim, search-param, and personalized reads into a dynamic child. 3. Put a focused `<Suspense>` boundary directly around that dynamic child. 4. Use a stable fallback with the same broad geometry as the resolved UI. 5. Start independent reads before awaiting them and avoid serial waterfalls. Keep `'use cache'` at the narrowest scope with an explicit, reviewable data contract. Do not hide runtime APIs behind helpers called from a cached scope. ## Invalidation After a successful mutation, invalidate the exact path or tag that owns the stale shared data. Personalized dynamic reads normally refresh through navigation or re-render and should not be placed in a shared tag to force reuse. ## Verification Run the Next.js build to catch prerender/runtime boundary errors. Exercise a cold navigation, a prefetched navigation, an anonymous request, and two distinct authenticated users to prove no personalized data crosses requests.
在 GitHub 查看