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: Get parent not root File node in resolver #13289

Merged
merged 2 commits into from
Apr 11, 2019

Conversation

stefanprobst
Copy link
Contributor

In the fileByPath resolver, we need a node's parent File node to resolve relative to absolute paths. For this we use findRootNodeAncestor, which will return a node's root node. This can be problematic for (unusual) scenarios like in #13267 where a node has more than one File node ancestor. We should just use the closest File parent.

Fixes #13267

@stefanprobst stefanprobst requested a review from a team as a code owner April 11, 2019 13:24
@wardpeet
Copy link
Contributor

Could we have a unit test for this one? In kitchen-sink perhaps?

@stefanprobst
Copy link
Contributor Author

Sure, test added!

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.

LGTM! At least once predicate thingie came in handy ;)

@pieh pieh merged commit 8031fcf into gatsbyjs:master Apr 11, 2019
@stefanprobst stefanprobst deleted the get-file-basepath-from-parent branch July 8, 2019 14:46
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.

File path infer problem
3 participants