Line

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

ui/client/features/notes/hooks/useNotes

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

Functions#

useNotes()#

useNotes(): object

Defined in: ui/client/features/notes/hooks/useNotes.tsx:18

The Notes screen, composed from small hooks. Notes are durable drafts on this machine: autosaved 800 ms after the last keystroke, kept across reloads and server restarts, never sent anywhere and never read by a model.

stateRef is the same state the reducer holds, advanced in the same order by send, so a save that starts right after another one finishes reads the rev the server just confirmed, not the one from the last render.

Returns#

object

confirmDelete

confirmDelete: (on) => void

Parameters
on

boolean

Returns

void

create

create: () => Promise<void>

Returns

Promise<void>

duplicate

duplicate: () => Promise<void>

Returns

Promise<void>

edit

edit: (e) => void

Parameters
e

Partial<Draft>

Returns

void

flush

flush: () => Promise<boolean> = save

Returns

Promise<boolean>

keepMine

keepMine: () => void

Returns

void

loadTheirs

loadTheirs: () => void

Returns

void

open

open: (id) => Promise<void>

Parameters
id

string

Returns

Promise<void>

remove

remove: () => Promise<void>

Returns

Promise<void>

retry

retry: () => Promise<boolean> = save

Returns

Promise<boolean>

state

state: ScreenState

toggleCompare

toggleCompare: () => void

Returns

void