Skip to main content

Function: useSubmission()

function useSubmission(id): object;

Defined in: hooks.ts:433

useSubmission(id) — read one stored submission and follow it (docs/06 §4, docs/17 §3.3).

E1.1 names it in its deliverable list and it did not exist. What it is for is everything AROUND a form rather than inside one: a draft list, a "queued / sent / rejected" chip beside each row, a supervisor screen opening yesterday's interview to read it. Every one of those had to reach past the library into the raw adapter, and then had no way to know when the row changed.

It subscribes to the adapter's change feed rather than polling, so an autosave commit or a status the sync engine stamps refreshes the row. An adapter with no feed still works — it simply does not update until the id changes.

Outside a provider, or with no storage, it stays loading: true for ever, which docs/17 §3.3 specifies: a list that renders "no drafts" because the database has not opened yet is worse than one that says nothing.

Parameters

ParameterType
idstring

Returns

object

attachments

attachments: Attachment[];

loading

loading: boolean;

status?

optional status?: SubmissionStatus;

submission?

optional submission?: Submission;

patch()

patch(partial): Promise<void>;

Parameters

ParameterType
partialPartial<Submission>

Returns

Promise<void>

remove()

remove(): Promise<void>;

Returns

Promise<void>