Part 7 - Arrays and Lists

This is part 7 of this series

This part is based on Arrays and Lists | Relay

Outline:

  • Implement topStories field in Query
  • Re-generate schema.graphql
  • Query topStories in Newsfeed component

For this part we need to implement topStories field that returns the first 3 stories in our demo dataset. This is straighforward given our current setup: https://github.com/tuan/newsfeed-demo-app/commit/93088f7225567bf7014ec7759072ff5417073add

After making the change, you can do a quick test using GraphiQL:

Now, re-generate the schema with :

rm -f api/schema.graphql && strawberry export-schema api.schema:schema > api/schema.graphql

After making the client side changes as described by Relay tutorial page, you should be able to see 3 posts show up on the homepage.