Configuration options
Persistence state and controls
This hook provides automatic saving of polls to file storage. It uses the Hiyve client's file upload/modify APIs to persist data to S3.
Features:
function PollsWithPersistence() {
const [polls, setPolls] = useState<Poll[]>([]);
const pollsRef = useRef(polls);
const {
fileId,
isSaving,
hasUnsavedChanges,
save,
markUnsaved,
} = usePollPersistence({
client,
enabled: true,
userId: localUserId,
roomName: room?.name,
pollsRef,
onSave: (id) => console.log('Saved to:', id),
});
useEffect(() => {
markUnsaved();
}, [polls, markUnsaved]);
}
Hook for polls persistence with auto-save.