Skip to content

useDocumentForm hook undefined in livePreview #11399

@bratvanov

Description

@bratvanov

Describe the Bug

The useDocumentForm hook added in #9869 is not available in livePreview.

Link to the code that reproduces this issue

https://github.com/bratvanov/payloadcms-usedocumentform-livepreview-undefined/commit/a9c00f80e3c2747c531ecaddb157ea07a4dcdb65

Reproduction Steps

Related to: #9869

  1. Add a custom block with useDocumentForm to the Lexical editor in a livePreview-enabled collection.

When in "Edit" mode, the document form data is being logged as expected:

Parent Document Fields: {title: {…}, content: {…}, updatedAt: {…}, createdAt: {…}}

However, after clicking on "Live Preview" in the admin panel, then useDocumentForm becomes undefined:

Parent Document Fields: undefined

CC: @AlessioGr

Which area(s) are affected? (Select all that apply)

plugin: richtext-lexical

Environment Info

Node: 22.12.0
payload: 3.24.0
next: 15.1.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions