アクティベートするタイミング
サーバーHTMLとクライアントの状態の間のハイドレーション不一致
affaan-m/ECC
Review nuxt4-patterns's use cases, installation, workflow, and original source instructions.
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/nuxt4-patterns"Source checked Jul 28, 2026·Refresh due Oct 26, 2026
Limited to facts supported by the pinned source
SSR、ハイブリッドレンダリング、ルートルール、またはページレベルのデータフェッチングを使用してNuxt 4アプリを構築またはデバッグするときに使用する。
npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/nuxt4-patterns"The pinned source contains about 155 English words and 6 usable sections. That evidence supports a source profile, not a complete guide.
155 source words · 6 usable sections
What the source actually contains
Sections are extracted automatically from the pinned SKILL.md and link back to the source.
サーバーHTMLとクライアントの状態の間のハイドレーション不一致
最初のレンダリングを決定論的に保つ。SSRレンダリングされたテンプレートの状態にDate.now()、Math.random()、ブラウザのみのAPI、またはストレージ読み取りを直接入れないこと。
ページとコンポーネントでSSR安全なAPI読み取りにはawait useFetch()を優先する。サーバーでフェッチしたデータをNuxtペイロードに転送し、ハイドレーション時の2回目のフェッチを避ける。
Static permission evidence
These are source excerpts matched by deterministic rules, not findings of malicious behavior, safety, or actual execution.
Choose a different workflow
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailReview nuxt4-patterns's use cases, installation, workflow, and original source instructions.
A separate implementation from affaan-m/ECC; compare its source, maintenance signals, and permission requirements.
Open source detailFAQ
The source record exposes this install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/ja-JP/skills/nuxt4-patterns". Inspect the command and pinned source before running it.
Static rules flagged network in the source; the page lists the matching lines and excerpts.
Quality breakdown
Based on traceable docs and repository signals; stars are not treated as quality.
Compare before choosing
These links are selected from shared tasks, functions, stacks, platforms, and same-name variants. Compare the source owner, documentation, permissions, and maintenance signals.
SSR、ハイブリッドレンダリング、ルートルール、またはページレベルのデータフェッチングを使用してNuxt 4アプリを構築またはデバッグするときに使用する。
useFetch、useAsyncData、または$fetchを使ったページやコンポーネントのデータフェッチングDate.now()、Math.random()、ブラウザのみのAPI、またはストレージ読み取りを直接入れないこと。onMounted()、import.meta.client、ClientOnly、または.client.vueコンポーネントの後ろに移動する。vue-routerのものではなく、NuxtのuseRoute()コンポーザブルを使用する。route.fullPathを使用しない。URLフラグメントはクライアントのみであり、ハイドレーション不一致を引き起こす可能性がある。ssr: falseは不一致のデフォルト修正としてではなく、真にブラウザのみの領域のエスケープハッチとして扱う。await useFetch()を優先する。サーバーでフェッチしたデータをNuxtペイロードに転送し、ハイドレーション時の2回目のフェッチを避ける。$fetch()呼び出しでない場合、カスタムキーが必要な場合、または複数の非同期ソースを構成する場合はuseAsyncData()を使用する。useAsyncData()にキャッシュの再利用と予測可能なリフレッシュ動作のための安定したキーを提供する。useAsyncData()ハンドラを副作用なしに保つ。SSRとハイドレーション中に実行される可能性がある。$fetch()はユーザーによるトリガーの書き込みまたはクライアントのみのアクションに使用し、SSRからハイドレートされるべきトップレベルのページデータには使用しない。lazy: true、useLazyFetch()、またはuseLazyAsyncData()を使用する。UIでstatus === 'pending'を処理する。server: falseはSEOや最初のペイントに不要なデータのみに使用する。pickでペイロードサイズを削減し、深いリアクティビティが不要な場合はより浅いペイロードを優先する。const route = useRoute()
const { data: article, status, error, refresh } = await useAsyncData(
() => `article:${route.params.slug}`,
() => $fetch(`/api/articles/${route.params.slug}`),
)
const { data: comments } = await useFetch(`/api/articles/${route.params.slug}/comments`, {
lazy: true,
server: false,
})
レンダリングとキャッシング戦略にはnuxt.config.tsのrouteRulesを優先する:
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true },
'/products/**': { swr: 3600 },
'/blog/**': { isr: true },
'/admin/**': { ssr: false },
'/api/**': { cache: { maxAge: 60 * 60 } },
},
})
prerender: ビルド時の静的HTMLswr: キャッシュされたコンテンツを提供しながらバックグラウンドで再検証isr: サポートされているプラットフォームでの増分静的再生成ssr: false: クライアントレンダリングルートcacheまたはredirect: Nitroレベルのレスポンス動作グローバルではなくルートグループごとにルートルールを選択する。マーケティングページ、カタログ、ダッシュボード、APIは通常異なる戦略が必要。
Lazyプレフィックスを使用する。v-ifで遅延コンポーネントを条件付きでレンダリングする。<template>
<LazyRecommendations v-if="showRecommendations" />
<LazyProductGallery hydrate-on-visible />
</template>
defineLazyHydrationComponent()を使用する。NuxtLinkを使用する。$fetchではなくuseFetchまたはuseAsyncDataを使用している