Skip to content

usePersistentBlockIdentity

usePersistentBlockIdentity<T>(options): UsePersistentBlockIdentityResult

Defined in: inspector-runtime-model.tsx:317

Keep one block attribute populated with a stable document-level id that survives normal edits and repairs duplicates inside the current block tree.

autoRepair defaults to enabled when omitted. Callers should pass a stable or memoized blocks reference so equivalent renders can reuse cached repair analysis instead of re-walking the full document tree.

T extends object

UsePersistentBlockIdentityOptions<T>

Current block identity inputs including the attribute key, editor tree snapshot, and setAttributes callback.

UsePersistentBlockIdentityResult

The current/pending persistent id plus a helper that can force the attribute repair immediately. nextPersistentId can stay null when no repair is pending yet, while ensurePersistentId() always returns a non-null string.