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

Allow subobjects in markdown frontmatter arrays to link to files #2255

Merged
merged 2 commits into from
Sep 28, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Format and cleanup comments
  • Loading branch information
KyleAMathews committed Sep 28, 2017
commit 04a6d0ec4e7fe946456647fd0553f77cc609068b
7 changes: 3 additions & 4 deletions packages/gatsby/src/schema/infer-graphql-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,13 @@ function shouldInferFile(nodes, key, value) {

if (value === undefined || value === null) continue

if (typeof value === "object" || typeof value === "function") {
if (typeof value === `object` || typeof value === `function`) {
visit(current[key], selector.concat([key]), fn)
continue
}

let proceed = fn(current[key], key, selector, current)

// returning false (and only false)
// from the visitor function will stop the
// visitations
if (proceed === false) {
break
}
Expand All @@ -418,6 +415,8 @@ function shouldInferFile(nodes, key, value) {
let isMatch = false
visit(n, [], (v, k, selector, parent) => {
if (v === value) {
// Remove integers as they're for arrays, which our passed
// in object path doesn't have.
const normalizedSelector = selector
.map(s => (isNormalInteger(s) ? `` : s))
.filter(s => s !== ``)
Expand Down