-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v2] fix find-page #5228
Conversation
if ( | ||
typeof __PREFIX_PATHS__ !== `undefined` && | ||
typeof __PATH_PREFIX__ !== `undefined` | ||
) { |
There was a problem hiding this comment.
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 ) :(
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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 bestripBasename
from my understanding,so about about rename the
prefix-paths
tobasename
in thegatsby-config
section, thenbasename
with trailing slash is pathPrefix, and we can address it in another PR, any thoughts @KyleAMathews @m-allanson @jquense