funkhaus / wp-gql-gutenberg

GNU General Public License v3.0
4 stars 3 forks source link

Accessing gutenberg blocks will break next/prev queries #52

Open drewbaker opened 1 year ago

drewbaker commented 1 year ago

So depending on where you use GutenbergBlocks in the GQL document, it will break nextPost or previousPost queries.

For example, previousPost and nextPost will be null when accessed like this:

#import "~/gql/fragments/GutenbergBlocks.gql"

query NewsDetail($uri: String!) {
    nodeByUri(uri: $uri) {
        id
        ... on Post {

            ...GutenbergBlocks

            previousPost {
                node {
                    ... on Post {
                        id
                    }
                }
            }
            nextPost {
                node {
                    ... on Post {
                        id
                    }
                }
            }
        }
    }
}

But if you move ...GutenbergBlocks to be after nextPost then they work fine. This might be related this function in our theme, but I doubt it: https://github.com/funkhaus/fuxt-backend/blob/master/functions/gql-functions.php#L229

rsm0128 commented 1 year ago

@drewbaker I can't replicate the error on my end. I test it on my local, but it works fine on my local. Could you provide me the Post content so that I can test it correctly. Thanks!

drewbaker commented 1 year ago

I think this is going to be a hard thing to debug, because it probably depends on the contents of the blocks... next time I run into it I will capture here.