Type AliasDraftsContextValue

DraftsContextValue: {
    clearSyncError: (() => void);
    deleteDraft: ((formSubmissionDraftId: string) => Promise<void>);
    drafts: draftService.LocalFormSubmissionDraft[];
    isLoading: boolean;
    isSyncing: boolean;
    lastSyncTime: Date | null;
    syncDrafts: ((abortSignal: AbortSignal | undefined) => Promise<void>);
    syncError: Error | null;
}

The value returned from useDrafts() hook

Type declaration

  • clearSyncError: (() => void)

    A function to clear Error object from syncing drafts

      • (): void
      • Returns void

  • deleteDraft: ((formSubmissionDraftId: string) => Promise<void>)

    A function to remove a draft

      • (formSubmissionDraftId): Promise<void>
      • Parameters

        • formSubmissionDraftId: string

        Returns Promise<void>

  • drafts: draftService.LocalFormSubmissionDraft[]

    The incomplete submissions that were saved for later

  • isLoading: boolean

    true if drafts are currently loading for the first time.

  • isSyncing: boolean

    true drafts are syncing with other devices

  • lastSyncTime: Date | null

    The date when the sync process last completed successfully, will be null until it has completed the first time.

  • syncDrafts: ((abortSignal: AbortSignal | undefined) => Promise<void>)

    A function to trigger syncing of the drafts

      • (abortSignal): Promise<void>
      • Parameters

        • abortSignal: AbortSignal | undefined

        Returns Promise<void>

  • syncError: Error | null

    An Error object if syncing drafts fails