Skip to content

Join field: edit drawer of a row does not open again after closing it (useDocumentDrawer always reports isDrawerOpen: false) #19232

Open

Description

@digitalwerber

Describe the Bug

In a join field's relationship table, clicking a row opens the edit drawer. After closing it, clicking the same row again does nothing.

useDocumentDrawer (packages/ui/src/elements/DocumentDrawer/index.tsx) returns a hardcoded isDrawerOpen: false ("Not tracking isDrawerOpen to prevent re-renders"). The relationship table relies on it to reset the current document id once the drawer closes (if (!isDrawerOpen)), so the id is never reset and the drawer for that row cannot be reopened. The relationship field also uses it for backspaceRemovesValue and disableKeyDown/disableMouseDown while the drawer is open. In 3.x the value came from modalState[drawerSlug]?.isOpen.

Link to the code that reproduces this issue

https://github.com/digitalwerber/payload/blob/fix/document-drawer-is-open/test/joins/e2e.spec.ts (test added on this branch)

Reproduction Steps

  1. Run the joins test suite config.
  2. Open a document with a join field and click a row in the join table: the edit drawer opens.
  3. Close the drawer and click the same row again: nothing happens.

Which area(s) are affected?

area: ui

Environment Info

payload: 4.0.0-beta.6
@payloadcms/ui: 4.0.0-beta.6
@payloadcms/db-d1-sqlite: 4.0.0-beta.6
next: 16.4.2
node: 24.22.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugPayload OSSarea: ui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions