Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/client/features/notes/hooks/useNoteSave

Cockpit client (features), next. Source: ui/client/features/notes/hooks/useNoteSave.tsx.

Functions#

useNoteSave()#

useNoteSave(stateRef, send): () => Promise<boolean>

Defined in: ui/client/features/notes/hooks/useNoteSave.tsx:14

Save the open note against the rev the server last confirmed. Saves run one at a time, in order, and each one reads the latest state when it starts, so a save queued behind another never goes out with a rev the first one already moved on. Resolves true when nothing is left unsaved. A failure or a stale write resolves false and leaves the typed text in the page.

Parameters#

stateRef

MutableRefObject<ScreenState>

send

(a) => void

Returns#

() => Promise<boolean>