Hiyve Components - v1.0.0
    Preparing search index...

    Interface UseAssignmentPersistenceOptions

    Options for the useAssignmentPersistence hook.

    Configures auto-save behavior for assignments, including the save interval, file location, and callbacks for save lifecycle events.

    interface UseAssignmentPersistenceOptions {
        autoSaveInterval?: number;
        client: AssignmentFileClient | null;
        content: JSONContent;
        enabled?: boolean;
        fileId?: string;
        fileLocation?: string;
        metadata: AssignmentMetadataState;
        onError?: (error: Error) => void;
        onSaved?: (fileId: string) => void;
        originalAuthorId?: string;
        originalAuthorName?: string;
        originalCreatedAt?: string;
        practicedMinutes?: number;
        title: string;
        userId: string;
        userName?: string;
    }
    Index

    Properties

    autoSaveInterval?: number

    Auto-save interval in milliseconds (default: 3000)

    client: AssignmentFileClient | null

    Hiyve client instance (must implement AssignmentFileClient)

    content: JSONContent

    Current content as JSON

    enabled?: boolean

    Whether persistence is enabled

    fileId?: string

    Existing file ID to update

    fileLocation?: string

    File storage location (default: '/Assignments')

    Assignment metadata state

    onError?: (error: Error) => void

    Callback on save error

    onSaved?: (fileId: string) => void

    Callback after successful save

    originalAuthorId?: string

    Original author of the assignment, when known (i.e. when editing an existing assignment). The save logic preserves these fields on the persisted file rather than overwriting them with the current user's identity — without this, a student auto-saving during their session would flip the author to themselves and the teacher would lose ownership.

    originalAuthorName?: string
    originalCreatedAt?: string
    practicedMinutes?: number

    Total practice minutes the writing user has logged for this assignment. Used when persisting appData.userStatuses[userId] so a viewer's status reflects what the host knows about their own practice — useful when practice is tracked in an external log (server-side PracticeLog) and the file's userActivities map hasn't picked up the latest session yet (common at unmount, when the session ends in the cleanup pass and save can't read the post-state value before the file is written).

    title: string

    Assignment title

    userId: string

    Current user ID

    userName?: string

    Current user display name