Skip to content

Draft parameter isn't accepted by or cascaded into the rich text field #6643

Closed as not planned

Description

@evelynhathaway

Link to reproduction

No response

Describe the Bug

Links that are relationships inside a rich text field links do not return drafts if the parent query has the draft parameter. The specific rich text field doesn't provide a draft parameter to GraphQL either.

The result is that all rich text relationship links will always return the published version (or the first draft if no published version exists).

This solves unexpected behavior like broken rich text relationship links in our frontend if the linked document location changed since the linked document was last published (or since the first draft if no published version exists).

Similar functionality was added to first class relationship fields as part of: #4985

To Reproduce

  1. Create a collection with drafts, a slug field, and a rich text field
  2. Create two documents in the collection with unique slugs, then publish them
  3. For one of the documents (let's call it document A), change the slug and save as a draft
  4. In the rich text field for document B, link to document A using the internal link type
  5. Save draft and preview document B
  6. Note that the link to document A on document B points to the slug of the published version, which isn't found in draft mode

Payload Version

v2.16.1

Adapters and Plugins

Slate Editor, MongoDB

Activity

  1. added
    status: needs-triage
    on Jun 5, 2024
  2. added
    plugin: richtext-slate
    on Jun 5, 2024
  3. removed
    status: needs-triage
    on Jun 10, 2024
  4. added
    status: cant-reproduce
    on Jun 19, 2024
  5. AlessioGr commented on Jun 19, 2024

    @AlessioGr
    Member

    Hey @evelynhathaway I'm not able to reproduce this issue.
    In draft mode, doc b links to doc a with slug a2 and in non-draft mode, doc b links to doc a with slug a. a2 coming from the draft version, and a coming from the published version. So this works as expected:

    CleanShot.2024-06-19.at.14.40.22.mp4

    I did test this on payload v2.21.0 and @payloadcms/richtext-slate 1.5.2. Could you upgrade to these versions and see if that fixes it for you? If it does not, could you provide me with a repository which reproduces this, optimally with a small int test?

  6. AlessioGr commented on Nov 12, 2024

    @AlessioGr
    Member

    Closing as not reproducible (likely already fixed). If you still experience this issue in the latest v3 of payload, please open up a new issue

  7. removed
    status: cant-reproduce
    on Nov 12, 2024
  8. github-actions commented on Nov 14, 2024

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  9. locked as resolved and limited conversation to collaborators on Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

plugin: richtext-slate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions