Skip to content
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

example: Fetching data using Apollo client (pages router) #58

Closed
moonmeister opened this issue Feb 13, 2025 · 8 comments
Closed

example: Fetching data using Apollo client (pages router) #58

moonmeister opened this issue Feb 13, 2025 · 8 comments
Assignees
Labels
example topic:client Related to GraphQL clients

Comments

@moonmeister
Copy link
Member

moonmeister commented Feb 13, 2025

Description

Create a tutorial to give a step-by-step guidance on setting up a WordPress powered blog section in Next.js app. Tutorial will teach how to fetch data using Apollo Client and present it with Next.js pages router in the context of a common, real-world use case.

Key Topics to Cover

  • Fetching list of blog posts using Apollo Client
  • Composing queries with GraphiQL IDE
  • Implementing pagination
  • Fetching and displaying single posts using Next.js pages router dynamic routes

Target Audience

  • Next.js web app owners who want to add blog section and use WordPress to support it
  • Frontend developers who want to get started with headless WordPress

Document Type

This should be a tutorial-style document, teaching basic concepts with tangible results to get started fast. Tutorial will give a working example of blog section in Next.js app, at the same time teaching how to recreate it independently.

@moonmeister moonmeister added example topic:client Related to GraphQL clients labels Feb 13, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Headless OSS Feb 13, 2025
@josephfusco josephfusco moved this from 🆕 Backlog to 🔖 Ready for Development in Headless OSS Feb 25, 2025
@ahuseyn ahuseyn self-assigned this Feb 25, 2025
@ahuseyn ahuseyn moved this from 🔖 Ready for Development to 🏗 In progress in Headless OSS Feb 26, 2025
@ahuseyn ahuseyn moved this from 🏗 In progress to 👀 In review in Headless OSS Feb 28, 2025
@ahuseyn
Copy link
Member

ahuseyn commented Feb 28, 2025

PR for tutorial: #69

@ahuseyn ahuseyn moved this from 👀 In review to 🏗 In progress in Headless OSS Feb 28, 2025
@ahuseyn
Copy link
Member

ahuseyn commented Feb 28, 2025

@moonmeister what was the original thought behind this ticket? Should we go with a real-world use-case and create an example for that or you have a different approach in your mind. For example the tutorial takes headless blog section use-case and explains data fetching with Apollo Client in that context. Could it be a useful example, what do you think?

@moonmeister
Copy link
Member Author

I don't think the document would be wholly unuseful, but as our conversation with Jason demonstrated, our focus needs to be on the code. The examples were meant as experiments as much as documentation. Let's focus on just getting the example done and we can always do the tutorial later.

@ahuseyn
Copy link
Member

ahuseyn commented Feb 28, 2025

@moonmeister absolutely agree that code examples should be priority. I was trying to ask what kind of code example was in your mind? Something like fetch post list, fetch single post, apply pagination (the blog use case) or other kind of use case. Or maybe little bit of everything (posts, settings, menu, etc.)? Just trying to get a sense of scope for the code example that I'll create.

@moonmeister
Copy link
Member Author

Ah, thanks for clarifying. That's a good question. So, the point of this example is to show the functionality of Apollo. So think of it in terms of a client-side only query, ssr/static query, hybrid query, paginated query, etc. Probably show with GET requests and APQ by default but show how to override for un-cached queries or mutations for a form. That help?

@ahuseyn
Copy link
Member

ahuseyn commented Mar 3, 2025

Thanks @moonmeister, that helps a lot.

@colinmurphy colinmurphy moved this from 🏗 In progress to 🔖 Ready for Development in Headless OSS Mar 5, 2025
@colinmurphy colinmurphy moved this from 🔖 Ready for Development to 🏗 In progress in Headless OSS Mar 5, 2025
@ahuseyn
Copy link
Member

ahuseyn commented Mar 5, 2025

I've added a draft PR to demonstrate the current progress. Feel free to suggest changes/additions.

@ahuseyn ahuseyn moved this from 🏗 In progress to 👀 In review in Headless OSS Mar 6, 2025
@ahuseyn
Copy link
Member

ahuseyn commented Mar 7, 2025

Closed by #73

@ahuseyn ahuseyn closed this as completed Mar 7, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Closed in Headless OSS Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example topic:client Related to GraphQL clients
Projects
Status: ✅ Closed
Development

No branches or pull requests

2 participants