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

fix(gatsby-plugin-create-client-paths): don't process pages that already use matchPath #9220

Merged
merged 1 commit into from
Oct 18, 2018

Conversation

i8ramin
Copy link
Contributor

@i8ramin i8ramin commented Oct 18, 2018

if page.matchPath || page.path.match(/dev-404-page/), we should resolve AND return

closes #9221

if `page.matchPath || page.path.match(/dev-404-page/)`, we should `resolve` **AND** `return`
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

Good catch. Thanks @i8ramin!

@pieh pieh changed the title Return on initial resolve() fix(gatsby-plugin-create-client-paths): don't process pages that already use matchPath Oct 18, 2018
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

I don't mind this for clarity (I like to do this myself!) but is this actually true?

Here's an example in Runkit of this not working like you describe, right? Ha, whoops adding a log confirms you're right!

Nice catch, indeed!

@i8ramin
Copy link
Contributor Author

i8ramin commented Oct 18, 2018

Here is my local test of this. I put some console.log's in the code and here is the output w/o the return and with the return

WITHOUT (current)

******* onCreatePage.BEGIN
******* onCreatePage.BEFORE_RESOLVE { path: '/dev-404-page/' }
******* onCreatePage.AFTER_RESOLVE { path: '/dev-404-page/' }
******* onCreatePage.PROCESSING... [ '/*' ]
******* onCreatePage.FINAL_RESOLVE
******* onCreatePage.BEGIN
******* onCreatePage.BEFORE_RESOLVE { path: '/auth/callback/' }
******* onCreatePage.AFTER_RESOLVE { path: '/auth/callback/' }
******* onCreatePage.PROCESSING... [ '/*' ]
******* onCreatePage.FINAL_RESOLVE
******* onCreatePage.BEGIN
******* onCreatePage.PROCESSING... [ '/*' ]
******* onCreatePage.FINAL_RESOLVE

WITH (patch)

******* onCreatePage.BEGIN
******* onCreatePage.BEFORE_RESOLVE { path: '/dev-404-page/' }
******* onCreatePage.BEGIN
******* onCreatePage.BEFORE_RESOLVE { path: '/auth/callback/' }
******* onCreatePage.BEGIN
******* onCreatePage.PROCESSING... [ '/*' ]
******* onCreatePage.FINAL_RESOLVE

@pieh pieh merged commit 6951db0 into gatsbyjs:master Oct 18, 2018
@gatsbot
Copy link

gatsbot bot commented Oct 18, 2018

Holy buckets, @i8ramin — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
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.

[gatsby-plugin-create-client-paths] function does not return on initial resolve()
3 participants