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

[v2] fix find-page #5228

Merged
merged 2 commits into from
May 3, 2018
Merged

[v2] fix find-page #5228

merged 2 commits into from
May 3, 2018

Conversation

nihgwu
Copy link
Contributor

@nihgwu nihgwu commented May 2, 2018

right now find-page is broken with prefix-paths
BTW, I think it's confusing to add the trailing slash to the prefixPath from user definition, but still use the same var name, it should be stripBasename from my understanding,
so about about rename the prefix-paths to basename in the gatsby-config section, then basename with trailing slash is pathPrefix, and we can address it in another PR, any thoughts @KyleAMathews @m-allanson @jquense

if (
typeof __PREFIX_PATHS__ !== `undefined` &&
typeof __PATH_PREFIX__ !== `undefined`
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this if seems to make related tests unhappy ( https://travis-ci.org/gatsbyjs/gatsby/jobs/374034245#L1484 ) :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but we don't do this check in other places, I just want to make them consistency, what about change the test code here https://github.com/gatsbyjs/gatsby/blob/v2/packages/gatsby/cache-dir/__tests__/loader.js#L5-L12?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should reset them to the proper values like '' and false instead of undefined, also I think we can drop the workaround for Node v6, do we still support that node version?
I see we still support v6 in the package.json, I think we can drop the support for that

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we can adjust tests, sure. Just keep in mind that we should check tests (some of them are still failing on v2 but we are working to get them all of the passing again - just let's not break tests that are already passing - either adjust code or tests - whichever make sense)

We want to support node 6 (related comment chain - #2641 (comment) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarifying

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tests are passing now

}
findPage = pageFinderFactory(newPages, pathPrefix)
findPage = pageFinderFactory(newPages, pathPrefix.slice(0, -1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use __PATH_PREFIX__ here? The slicing is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because we use slice in other places, when calculating then basename, I just want to keep consistency, I agree it's a bit redundant, but I think we can do it in another pathPrefix refactor which I described in the issues's description

Copy link
Contributor

Choose a reason for hiding this comment

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

ah right :-) You did cover this in the description 👍to that

@KyleAMathews KyleAMathews merged commit 0fab986 into gatsbyjs:v2 May 3, 2018
@nihgwu nihgwu deleted the neo/fix-find-page branch May 3, 2018 04:51
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