Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

823 B
Raw Blame
'use client';

import { Fragment, type ReactNode } from 'react';
import ListSkeleton from '@/components/common/skeleton/ListSkeleton';
import GodSectionPage from './GodSectionPage';

// Holds a settings page back until its stored state has loaded, then renders the form
// keyed on that state: a save replaces the cache entry, so the key changes and the
// form remounts with fresh initial values instead of a stale "dirty" comparison.
export default function GodSettingsGate<T>({
  slug,
  data,
  children,
}: {
  slug: string;
  data: T | undefined;
  children: (data: T) => ReactNode;
}) {
  if (!data) {
    return (
      <GodSectionPage slug={slug}>
        <ListSkeleton rows={5} rowClassName="h-12" />
      </GodSectionPage>
    );
  }
  return <Fragment key={JSON.stringify(data)}>{children(data)}</Fragment>;
}