Configuration options
Persistence state and controls
This hook provides automatic saving of notes to file storage. It uses the Hiyve client's file upload/modify APIs to persist data to S3.
Features:
function NoteWithPersistence() {
const { client } = useClient();
const { localParticipant } = useParticipants();
const [content, setContent] = useState<JSONContent>(EMPTY_CONTENT);
const [title, setTitle] = useState('');
const {
fileId,
isSaving,
hasUnsavedChanges,
lastSaved,
save,
markUnsaved,
} = useNotePersistence({
client,
content,
title,
enabled: true,
userId: localParticipant?.userId ?? '',
userName: localParticipant?.name,
onSaved: (id) => console.log('Saved to:', id),
});
// Mark unsaved when content changes
useEffect(() => {
markUnsaved();
}, [content, markUnsaved]);
return <NoteEditor onChange={setContent} />;
}
Hook for note persistence with auto-save.