wp-graphql / wpgraphql-acf

Re-architecture of WPGraphQL for ACF
GNU General Public License v3.0
91 stars 12 forks source link

Preview requiring multiple clicks to work #241

Open felipesnts opened 1 month ago

felipesnts commented 1 month ago

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.

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