Paragraphs in preview mode not working

Created on 4 December 2023, 12 months ago
Updated 15 January 2024, 10 months ago

Problem/Motivation

When using the graphQL compose module we can use the route parameter with preview urls. This seems to work, but when using paragraphs in an entity reference revisions field, the paragraphs donโ€™t have a target_id yet, and donโ€™t come as a result in my response. If i save the node first and then use the preview url of that node again the paragraphs get shown.
Not sure if this is a problem that can be fixed in graphql compose or in the graphql module itself.

๐Ÿ› Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium cedricl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @cedricl
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ

    Oh,
    Hmmm, quick look at it and it would be the difference between our `EntityPreviewBuffer` to get the node, and the `EntityRevisionBuffer` used by the GraphQL module `entity_reference_revisions` data producer, to get the related entities.

    This issue would have been introduced when we moved to a producer vs a looping entity loader via the $node->field_whater->entity. Mainly for cache and speed and less ownership over the code.

    Issue would probably affect any unsaved entity reference in preview (eg via inline entity module)

    Solution could probably get introduced in the gqlc `EntityReferenceRevisionsItem`
    Maybe a new shimmed producer, or a switch into a another producer for previews, or do some dodgy old loading when in previews.

    I reckon we can fix it.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium cedricl

    This seems to be related.
    https://www.drupal.org/project/decoupled_preview/issues/3398030 ๐Ÿ› Issue With Paragraph Entity Active

  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ

    Ok, lets give this a whirl.

    In the route i'm setting a preview context
    Then in the resolver I'm running a `cond` on that to use the property or the buffer.

    Let me know how you go.

  • Status changed to RTBC 11 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium cedricl

    Code works as intented. Can be merged.

    Thanks Almunnings!

  • Assigned to almunnings
  • Status changed to Fixed 11 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ

    Merged into 2.1.x-dev

    https://www.youtube.com/watch?v=aAkMkVFwAoo

    Cheers!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium cedricl

    It looks like the changes that happened in your merge request are removed from 2.1, in a later commit. I added a patch to re-include these changes, so the preview with paragraphs works again.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia almunnings Melbourne, ๐Ÿ‡ฆ๐Ÿ‡บ

    Afternoon brodeo,
    Perhaps I wasnโ€™t super clear in the other ticket. My bad.

    I canโ€™t reintroduce these changes, as they bypass access controls on referenced entities in preview mode.

    The fix youโ€™re looking for with anonymous/other user previews is in graphql_compose_preview dev module, which alters node access.

    Unless youโ€™re saying the previews donโ€™t work for the same user?

Production build 0.71.5 2024