Skip to content

GraphQL: Cannot set draft on nested relations. Can set draft where draft is not enabled. #4985

Closed

Description

@dacgray

Link to reproduction

No response

Describe the Bug

We have 2 collections.

TopFooterV1 - versioning with draft is NOT enabled.

StaticPageV1 - versioning with draft IS enabled.

1st Issue:

We cannot set a draft argument on the relation:

image
image

Would be very helpful if draft, where, locale, limit and sort are available.

2nd Issue:

The schema generator adds draft to a collection with versioning and drafts disabled:

  TopFooterV1s(draft: Boolean, where: TopFooterV1_where, fallbackLocale: FallbackLocaleInputType, locale: LocaleInputType, limit: Int, page: Int, sort: String): TopFooterV1s

To Reproduce

As above

Payload Version

2.9.0

Adapters and Plugins

"@payloadcms/bundler-webpack": "^1.0.6", "@payloadcms/db-mongodb": "^1.3.2", "@payloadcms/plugin-cloud-storage": "^1.1.1", "@payloadcms/plugin-sentry": "^0.0.6", "@payloadcms/richtext-slate": "^1.3.1",

Activity

  1. added
    status: needs-triage
    on Feb 3, 2024
  2. evelynhathaway commented on May 13, 2024

    @evelynhathaway
    Contributor

    I was running into this with an without GraphQL in #3963 (reply in thread).

    In Payload v2.16.1, I no longer experience it with the REST API and if I manually add the draft variable to each relationship; however, I am not getting the cascading behavior noted in #6141.

  3. JarrodMFlesch commented on May 14, 2024

    @JarrodMFlesch
    Contributor

    @evelynhathaway I just tested this and it seems to be working. Can you provide more context? Or possibly a small reproduction?

  4. evelynhathaway commented on May 14, 2024

    @evelynhathaway
    Contributor

    @JarrodMFlesch I think the difference is that I am using a global maybe?

    With this repro: evelynhathaway@9bd24ff

    And you open http://127.0.0.1:3000/api/graphql-playground and query:

    {
      Menu(draft: true) {
        relationship {
          text
        }
      }
    }

    The output is published example post, but if the draft variable is set on the relationship, it will return the draft:

    {
      Menu(draft: true) {
        relationship(draft: true) {
          text
        }
      }
    }
  5. evelynhathaway commented on May 28, 2024

    @evelynhathaway
    Contributor

    I also ran into this with Rich Text links that are relationships. At least with the Slate editor and GraphQL, there isn't a draft variable, and will always return the published version (or the first draft if no published version exists).

    This prevents rich text relationship links from working if the linked document location changed since the linked document was last published (or since the first draft if no published version exists)

    @JarrodMFlesch would it be best to reopen this issue, or shall I create new issues to track these sub-issues?

  6. JarrodMFlesch commented on May 29, 2024

    @JarrodMFlesch
    Contributor

    @evelynhathaway yes that would be super helpful actually!

  7. evelynhathaway commented on Jun 5, 2024

    @evelynhathaway
    Contributor

    Created #6642 and #6643 for the discussed sub-issues

  8. github-actions commented on Sep 7, 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 Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: needs-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions