gatsbyjs/gatsby-source-wordpress-experimental

Preview breaks on homepage when using "/" as the URI

ardiewen opened this issue · 1 comments

Hey @TylerBarnes,

Encountered a strange issue with my minimal repo under the following scenario:

  1. Create a page with any slug (e.g. "home")

  2. Set it as the home page in Settings -> Reading -> Your homepage displays -> A static page

    Screen Shot 2021-01-27 at 3 58 27 PM
  3. Verify the URI is "/" in wp-admin graphiql

    {
      "data": {
        "pages": {
          "edges": [
            {
              "node": {
                "id": "cG9zdDo1OA==",
                "title": "Home",
                "uri": "/",
                "isFrontPage": true
              }
            },
            {
              "node": {
                "id": "cG9zdDoy",
                "title": "Sample Page",
                "uri": "/sample-page",
                "isFrontPage": false
              }
            }
          ]
        }
      },
      "extensions": {
        "debug": []
      }
    }
    
  4. Modify any data (title, content, ACF) and the preview DOES gets generated, but does not get passed back to the wp-admin preview window that opens. I suspect this has something to do with the URI.

    For example, if I go: https://__MY_WP_DOMAIN/?preview=true ... it fails

    However, if I go: https://__MY_WP_DOMAIN/sample-page?preview=true ... it succeeds

  5. All other pages / posts / CPTs preview fine, even with ACF (on or off, I have tested both), as long as their URI is not "/"

    All documentation i've seen to date appears to use URI as the path to create pages, instead of slug. This appears to be correct, for good reason, as the slug can vary if there are autosaved posts, etc.

    My minimal repo is available here:
    https://github.com/ardiewen/gatsby-wordpress-preview-minimal

I have a new sanitized backend that I'm testing with. If you'd like an invite to that I can share that as well.

Relevant front end package versions:

"gatsby": "^2.31.1",
"gatsby-source-wordpress-experimental": "^7.0.3",

Relevant wp-admin plugin versions:

Advanced Custom Fields PRO 5.9.3
WP Gatsby 0.9.2
WP GraphQL 1.1.3
WPGraphQL Custom Post Type UI 1.1
WPGraphQL for Advanced Custom Fields 0.4.1

Hi @ardiewen , this is fixed on the latest version of WPGatsby - thanks for reporting this!