profound-logoProfound CMS
⌘K
Admin
Theme
DocsTutorialBlogPhilosophy
DocsTutorialBlogPhilosophy

Hybrid

Collection of Pages with ComponentsTypes of ComponentsSetup server sent events (SSE) content refetchInstall Profound CMS as a proxyCEL Scripting in Template BuilderProject ScaffoldingMedia Library

Headless

Quick startSplit Screen JSON Component Builder with LLMComponent Zod Pull

REST API

REST API 概要getウェブサイトを CMS API に接続するgetGET /routesgetGET /routegetGET /blocksgetGET /blocks/with-cel-cachegetGET /blocks/generatedgetGET /componentsgetGET /components/{name}getGET /dataset/{schema_name}getGET /content-changes (SSE)patchPATCH /dataset/{schema_name}postPOST /translationpatchPATCH /translationsgetGET /usagepostCSV 投稿patchPATCH /csv
All Systems Operational
Powered Byprofound-logo
Theme

Setup server sent events (SSE) content refetch

この機能は、「管理パネル」で内容が変更されたページを再レンダリングできるようにします。

この機能は、「管理パネル」で内容が変更されたページを再レンダリングできるようにします。

デフォルトでは、ページは静的なバージョンとして提供されます。

  1. 最新バージョンのレンダラーを使用します。
  2. 関連するデータベースエンティティの変更を検出するために、Server-Sent Events(SSE)を使用します。

layout.tsx ファイルを変更します。

import { Refresher } from 'cms-renderer/lib/refresher';
import { revalidatePath } from 'next/cache';

// 再検証時に実行する関数
async function revalidate() {
  'use server';
  revalidatePath('/', 'layout'); // これらのページのキャッシュを再計算します
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body className="min-h-screen bg-bg-base text-text-primary antialiased">
        <Refresher // 正しい認証情報を入力します
          websiteId={"..."}
          cmsUrl={"..."}
          apiKey={"..."}
          
        />
        {children}
      </body>
    </html>
  );
}

ルートレイアウトを変更した後、データベース内のフィールドを編集し、ページを更新すると変更が反映されます。

Continue Reading
Previous‹Types of ComponentsNextInstall Profound CMS as a proxy›