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 startJSON 与 Claude 代码组件 Zod 拉取

REST API

REST API 概览get连接网站 APIgetGET /routesgetGET /routegetGET /blocksget获取带有 CEL 缓存的区块getGET /blocks/generatedgetGET /componentsgetGET /components/{name}getGET /dataset/{schema_name}get获取内容变更 SSEpatchPATCH /dataset/{schema_name}postPOST /translationpatchPATCH /translationsgetGET /usagepostPOST /csvpatch修补 CSV
All Systems Operational
Powered Byprofound-logo
Theme

Setup server sent events (SSE) content refetch

此功能允许你重新渲染在“管理面板”中内容发生变化的页面

此功能允许你重新渲染在“管理面板”中内容发生变化的页面。

默认情况下,页面以静态版本提供。

  1. 使用我们渲染器的最新版本。
  2. 这会使用服务器发送事件(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›