-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-source-wordpress] Query endpoints with a sort order set #5006
Conversation
Deploy preview for using-drupal ready! Built with commit a745398 |
Deploy preview for gatsbygram ready! Built with commit a745398 |
I'm not against this change, but just for context - what problem does this solve? |
It looks like this reverses the default ordering: |
It won't break anything - only nodes will be inserted in different order and therefore also returned in different order if user didn't specify sort by field in query. @sebastienfi Can you let us know why you want this change? |
Sure! |
Unless there is bug, order of nodes shouldn't affect resulting schema - we construct |
@pieh That's true, I may be wrong, but it seems to me the schema builds by fusionning all the posts one by one to a consolidated vision of the fields, excluding each time what doesn't fit in the model at build.
I give you that an REST API sending this kind of result is completely wrong. Welcome in WordPress. If the post with ID of 1 is applied to the schema first, then querying |
In your example if we have mixed types for same field ( This is why I recommend on wordpress side to add acf filters to return |
@pieh Interesting. May you have an example of WP code to send null instead of false in such scenario? |
@sebastienfi check this comment - #4461 (comment) |
Is this something we could handle better in the WordPress plugin? e.g. if a field has I guess it's tricky to get this right automatically. But maybe we can make it easier to deal with. |
@m-allanson That's actually good idea - I'll give it a try. Previous idea was to replace all |
@sebastienfi Can we close this PR? |
Closing as this seems inactive. Please re-open if you'd like to pick this up again! |
Query the endpoints using the same order each time, with the first post in the head of the response.