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 OverviewgetConnect your websitegetGET /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 /usagepostPOST /csvpatchPATCH /csv
All Systems Operational
Powered Byprofound-logo
Theme

Setup server sent events (SSE) content refetch

This feature allows you re-render pages which had their content change on the “Admin Panel”

This feature allows you to re-render pages that had their content changed on the “Admin Panel”.

By default, pages are served as static versions.

  1. Using the latest version of our renderer.
  2. This uses Server-sent events (SSE) to detect changes to the relevant database entities.

We’ll modify our layout.tsx file.

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

// function to run on revalidation
async function revalidate() {
  'use server';
  revalidatePath('/', 'layout'); // re compute cache for these pages
}

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 // enter correct credentials
          websiteId={"..."}
          cmsUrl={"..."}
          apiKey={"..."}
          
        />
        {children}
      </body>
    </html>
  );
}

After changing your root layout, you can edit fields in your database and see updates reflected after refreshing the page.

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