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

Den här funktionen gör att du kan rendera om sidor som har fått sitt innehåll ändrat i "Admin Panel"

Den här funktionen gör att du kan rendera om sidor som har fått sitt innehåll ändrat i "Admin Panel".

Som standard levereras sidor som statiska versioner.

  1. Använd den senaste versionen av vår renderer.
  2. Det här använder serversända händelser (SSE) för att upptäcka ändringar i de relevanta databasentiteterna.

Vi ska ändra vår layout.tsx-fil.

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

// funktion som körs vid revalidering
async function revalidate() {
  'use server';
  revalidatePath('/', 'layout'); // beräkna om cachen för de här sidorna
}

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 // ange korrekta autentiseringsuppgifter
          websiteId={"..."}
          cmsUrl={"..."}
          apiKey={"..."}
          
        />
        {children}
      </body>
    </html>
  );
}

Efter att du har ändrat din root-layout kan du redigera fält i databasen och se uppdateringarna efter att du har uppdaterat sidan.

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