// app/page_editor_admin/page.tsx
// Server component — loads Puck data, renders editor

// IMPORTANT: force-dynamic ensures the editor ALWAYS loads fresh data from the
// database on every visit. Without this, Next.js caches the page and the editor
// loads stale data after switching tabs or revisiting the URL.
export const dynamic = 'force-dynamic';

import EditorClient from './editor-client';
import { getHomepageContent } from '@/lib/homepage-content';

export default async function EditorPage() {
  // Load current homepage data (always fresh from DB)
  const homepageData = await getHomepageContent();

  // Render the Puck editor
  return <EditorClient initialData={homepageData} />;
}
