Snapshots
Snapshots provide automatic version history for your templates. Every save creates a snapshot, allowing you to compare versions side-by-side and restore any previous state.
How It Works
- Automatic Saves — Snapshots are created automatically when a template is saved
- Browse History — Open the snapshots panel to see all previous versions with timestamps
- Compare — View what changed between versions
- Restore — Roll back to any previous version with one click
Composable
js
import { useSnapshotHistory } from '@templatical/core/cloud';
const {
snapshots, // Ref<TemplateSnapshot[]>
isLoading, // Ref<boolean>
isRestoring, // Ref<boolean>
loadSnapshots, // () => Promise<void>
restoreSnapshot, // (snapshotId) => Promise<Template>
} = useSnapshotHistory({
authManager,
templateId: 'template-id',
onRestore: (template) => {
// Template restored — update the editor
},
onError: (error) => { /* handle error */ },
});