Skip to content

fix: prevent gatsby file detection from breaking path field #1226

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

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

DSchau
Copy link
Contributor

@DSchau DSchau commented Oct 3, 2018

Fixes #1088

This should fix the path issues that people intermittently run into.
Gatsby sees the relative path (and the parent node with an absolute
path), joins on the parent path and the relative path, and presumes it's
a file... which is normally good, but which here is not what we want
as we're then getting a resolver of type file instead of type
string referring to the relative path of the document.

This seems to fix a (long standing?) bug where the "Edit this Page"
button is broken, as well. e.g. see a current community page vs. deploy preview community page

I'd need to think more as to whether there's a cleaner fix here, but
this seems to work pretty well!

Fixes reactjs#1088

This should fix the path issues that people intermittently run into.
Gatsby sees the relative path (and the parent node with an absolute
path), joins on the parent path and the relative path, and presumes it's
a file... which is normally good, but which here is not what we want
beacuse then we're getting a resolver of type file instead of type
string referring to the relative path of the document.

This seems to fix a (long standing?) bug where the "Edit this Page"
button is broken, as well. e.g. see [this page](https://reactjs.org/community/support.html) which _should_ have an Edit this Page button

I'd need to think more as to whether there's a cleaner fix here, but
this seems to work pretty well!
@facebook-github-bot
Copy link
Collaborator

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@reactjs-bot
Copy link

Deploy preview for reactjs ready!

Built with commit 77a39ff

https://deploy-preview-1226--reactjs.netlify.com

@alexkrolick
Copy link
Collaborator

alexkrolick commented Oct 3, 2018

Awesome work! 🥇

@alexkrolick alexkrolick merged commit 7d12082 into reactjs:master Oct 3, 2018
@DSchau DSchau deleted the gatsby/path-fix branch October 3, 2018 22:05
@gaearon
Copy link
Member

gaearon commented Oct 3, 2018

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

running locally on windows 10 gives errors
5 participants