RevisionHistory
Display caller-provided CMS revision snapshots and forward host-owned actions.
RevisionHistory displays caller-provided revisions, offers a JSON field snapshot preview and a field-by-field comparison with the current revision, and invokes onRestore with the selected revision ID and revision number. The component does not restore history; use the verified CMS/Fullstack lifecycle contract for any restore action.
API
| Prop | Type | Required | Default |
|---|---|---|---|
revisions | readonly CmsRevisionItem[] | Yes | — |
currentRevisionNumber | number | No | — |
loading | boolean | No | false |
error | ReactNode | No | — |
confirmRestore | boolean | No | false |
onRestore | (revisionId, revisionNumber) => void | Promise<void> | No | Read only |
className | string | No | — |
import { createCmsClient } from "@puzzle-ui/fullstack/cms/client";
import { RevisionHistory } from "@puzzle-ui/pieces";
const cms = createCmsClient({ basePath: "/api/cms" });
const articles = cms.collection("articles");
const revisions = await articles.listRevisions(entry.id, 20);
const restoreRevision = async (revisionId: string) => {
await articles.restoreRevision(entry.id, {
expectedRevision: entry.revision,
revisionId,
});
};
<RevisionHistory
revisions={revisions}
currentRevisionNumber={entry.revisionNumber}
onRestore={(revisionId) => restoreRevision(revisionId)}
/>;The Fullstack collection client exposes listRevisions and restoreRevision
when the collection enables drafts. listRevisions returns an array of flat
CmsApiRevision records whose public fields map to CmsRevisionItem; no
tenant ID is sent to the browser.
The comparison is shown when the revision identified by
currentRevisionNumber is included in revisions; provide it alongside any
historical page you want to compare. It shows added, removed, and changed
top-level fields, including nested values, but does not compare metadata such
as status or slug. Set confirmRestore to ask before invoking the callback.
The active revision cannot be restored. Callback failures are announced to
the user.
Related
API maturity
API maturity: Stable.
RestaurantMenuSection
Compose multiple restaurant menus with categories, anchor navigation, responsive dish cards, caller-supplied dietary labels, and optional dietary filtering.
RoadmapSection
Present SaaS roadmap milestones by date, status, release, or group with optional accessible progress indicators.