ryelle / Foxhound

A text-focused blog theme for WordPress (in React)
https://themes.redradar.net/foxhound
349 stars 39 forks source link

Wordpress 4.7 REST API and GraphQL #33

Closed cr101 closed 7 years ago

cr101 commented 7 years ago

Assuming that the WP REST API Plugin is merged into WP 4.7 core, will the Foxhound theme be switched over to the WP API in core instead?

Also, do you have any plans to use GraphQL with the WP API in core?

ryelle commented 7 years ago

Yep! The theme already supported the WP core implementation of the API (the readme was just outdated, and has been updated).

I probably won't move to GraphQL - I think this project is wrapping up, so I don't want to make any more API-level changes here.

cr101 commented 7 years ago

Using the WP Rest API to fetch the data for the theme doesn't quite make sense as the WP Rest API is self consuming (the end points live on the same server I am serving the theme from) and I can save myself the round trip requests from the browser to the server and then back down to the browser again. This is where GraphQL could cut down the number of data requests. Thank you for sharing your hard work. Much appreciated. Hopefully you will change your mind about GraphQL!

ryelle commented 7 years ago

I can save myself the round trip requests from the browser to the server

This is true, but in this case we're saving time by a) preloading the initial page of data which is returned from the server when the page loads, and b) we're only fetching the API data on subsequent page views, so the server doesn't have to render the entire page + asset requests again.

cr101 commented 7 years ago

This GraphQL endpoint for WordPress looks like a great project. Your thoughts?