Skip to content

Preview requiring multiple clicks to work #241

@felipesnts

Description

@felipesnts

Description

Preview is requesting multiple clicks on the WP "Preview Changes" button in order for GraphQL to return the correct preview values.

Steps to reproduce

  1. Clean WP install
  2. Installed: Advanced Custom Fields PRO 6.3.8, Classic Editor 1.6.5, WPGraphQL 1.28.1, WPGraphQL for ACF 2.4.1
  3. Added one test ACF field to post types "page" (JSON included below)
  4. Created 2 test pages

I get different behavior between the two pages.
On one of them preview works as expected.
On the other page, if I edit the AFC field content, click preview and then make a GraphQL request, it returns the published value, if I click on preview again, it returns the preview value. If I then make another edit and click preview, GraphQL returns the original published value again, so I have to click preview a second time to get the preview value to actually show in the GraphQL response.
I could not figure out why both pages behave differently since nothing different was done when I created both of them up.

PHP or JSON export of the ACF Field Group(s)

[
    {
        "key": "group_66fedede4ad3a",
        "title": "Page Content",
        "fields": [
            {
                "key": "field_66fedede25586",
                "label": "Subtitle",
                "name": "subtitle",
                "aria-label": "",
                "type": "text",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "translations": "translate",
                "maxlength": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "show_in_graphql": 1,
                "graphql_description": "",
                "graphql_field_name": "subtitle",
                "graphql_non_null": 0
            }
        ],
        "location": [
            [
                {
                    "param": "post_type",
                    "operator": "==",
                    "value": "page"
                }
            ]
        ],
        "menu_order": 0,
        "position": "normal",
        "style": "default",
        "label_placement": "left",
        "instruction_placement": "label",
        "hide_on_screen": "",
        "active": true,
        "description": "",
        "show_in_rest": 0,
        "acfe_autosync": "",
        "acfe_form": 0,
        "acfe_display_title": "",
        "show_in_graphql": 1,
        "graphql_field_name": "pageContent",
        "map_graphql_types_from_location_rules": 0,
        "graphql_types": "",
        "acfe_meta": "",
        "acfe_note": ""
    }
]

Additional context

No response

WPGraphQL Version

1.28.1

WPGraphQL For ACF Version

2.4.1

ACF (Advanced Custom Fields) Version. Free or Pro?

6.3.8 Pro

WordPress Version

6.6.2

PHP Version

8.2.21

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions