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

refactor(gatsby): Get list of /dev-404-page/ pages via graphql #13186

Merged

Conversation

Moocar
Copy link
Contributor

@Moocar Moocar commented Apr 7, 2019

Description

The gatsby develop /dev-404-page/ shows a list of pages on the site. This is currently sourced from pages.json which is written during bootstrap. #13004 aims to remove reliance on global files such as data.json. This PR changes /dev-404-page/ to source the list of pages directly from the running develop serve via a graphql query, and removes reliance on pages.json.

Note, that this isn't absolutely necessary for #13004, but it does move us closer to a world where the webpack build doesn't need to know about page data.

Related Issues

@Moocar Moocar requested a review from a team as a code owner April 7, 2019 02:40
@Moocar Moocar changed the title Raw dev 404 use graphql for pages refactor(gatsby): Get list of /dev-404-page/ pages via graphql Apr 7, 2019
@KyleAMathews
Copy link
Contributor

Not in this PR but something we might want to do is move this to a searchable interface. E.g. show only say 100 pages by default and then people can search using glob or regex syntax.

As it is, this query and page don't scale up to very many pages.

@pieh
Copy link
Contributor

pieh commented Apr 7, 2019

This is dev-only so for that we could use some client-side graphql request (i.e. https://www.npmjs.com/package/graphql-request seems really lightweight) against gatsby schema that uses limit + some filter.

@Moocar
Copy link
Contributor Author

Moocar commented Apr 7, 2019

Yep, I was thinking of limiting the results as I was working on this, but decided it was better left to another day. As it is, the page is only real useful for small sites.

@KyleAMathews
Copy link
Contributor

For simple client-side usages of GraphQL, fetch is all you need.

@KyleAMathews
Copy link
Contributor

Added an issue to track the follow-up work #13204

Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@KyleAMathews KyleAMathews merged commit e9e6d4e into gatsbyjs:master Apr 16, 2019
@Moocar
Copy link
Contributor Author

Moocar commented Apr 17, 2019

Published in [email protected]

quinnmcphail added a commit to quinnmcphail/gatsby that referenced this pull request Apr 17, 2019
KyleAMathews pushed a commit that referenced this pull request Apr 27, 2019
* Limited to 100 pages rendered. Added search functionality.

Fixed variables

Updated to work with #13186

* Fix ignore so raw 404 page gets copied over
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants