Skip to main content

Interface: UnsavedSurface

Defined in: src/lib/forms/unsavedGuard.ts:15

Cross-surface unsaved-changes guard. Forms register themselves while dirty via useUnsavedGuard; navigation/close flows call confirmUnsaved() before discarding work. If any surface is dirty it opens a single shared modal (rendered by <UnsavedChangesHost/>) offering Save / Discard / Stay, and resolves true only on Save or Discard. A beforeunload backstop protects against tab/refresh while anything is dirty.

Imperative-promise + useSyncExternalStore pattern mirrors DangerConfirm.tsx.

Properties

discard?

optional discard?: () => void

Defined in: src/lib/forms/unsavedGuard.ts:21

Returns

void


id

id: number

Defined in: src/lib/forms/unsavedGuard.ts:17

Stable id assigned per registration; opaque to callers.


label

label: string

Defined in: src/lib/forms/unsavedGuard.ts:19

Human-readable name shown in the modal list (e.g. "Contractor details").


save?

optional save?: () => void | Promise<void>

Defined in: src/lib/forms/unsavedGuard.ts:20

Returns

void | Promise<void>