Cursor pagination showing duplicate posts when using where{search} with after
Hello,
My team has noticed the following:
A query using where {search: } will show the same posts on multiple pages when using after: endCursor. Typically the first 3-6 posts of the search results are the same on every page, but results further down the page do change from page-to-page. I was able to duplicate the behavior in the GraphQL IDE. Disabling WPML causes the search query to work correctly.
We're looking into possible solutions, but I thought I would bring it up here as well. I'll let you know if I find anything out.
Best,
Matt
@matthewtompkins I'd recommend installing and activating the "Query Monitor" plugin, then activating Query Logs in WPGraphQL (under GraphQL > Settings)
Then you can see the underlying SQL that is being generated.
Disabling WPML causes the search query to work correctly
My hunch is that WPML is doing something to filter WP_Query that is overriding / conflicting with what WPGraphQL expects of WP_Query.
If you can pinpoint what WPML is doing to the queries, perhaps it can be filtered out, so WPGraphQL can do its thing uninterrupted?
as we are using the plugin for a gatsby site where we basically just suck all pages out of wordpress I am not sure I can assist here. The problem is that WPML is extremely invasive and basically intercepts all wordpress queries and rewrites them. This plugin is specifically only designed with this usecase in mind (and even there it is still lacking) and does the bare minimum to allow downloading the whole content.
Hey @jasonbahl and @rburgst,
Thanks for the feedback. @jasonbahl I will do some experimentation sometime this sprint with query logs and get back to you with any information I find.
@rburgst understood. We toyed with the idea of switching to Polylang during our headless project planning. Unfortunately, our content team uses Crowdin for translations, and the Polylang team told me they currently don't offer an integration with Crowdin. So unfortunately we had to go on with WPML.