Skip to content

Commit 14ae101

Browse files
committed
Allow arrays with more than one file path & ignore empty strings
1 parent 9d3173b commit 14ae101

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/gatsby/src/schema/infer-graphql-type.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,12 @@ export function inferObjectStructureFromNodes({
589589
// pointing to a file (from another file).
590590
} else if (
591591
nodes[0].internal.type !== `File` &&
592-
((_.isString(value) && shouldInferFile(nodes, nextSelector, value)) ||
592+
((_.isString(value) &&
593+
!_.isEmpty(value) &&
594+
shouldInferFile(nodes, nextSelector, value)) ||
593595
(_.isArray(value) &&
594-
value.length === 1 &&
595596
_.isString(value[0]) &&
597+
!_.isEmpty(value[0]) &&
596598
shouldInferFile(nodes, `${nextSelector}[0]`, value[0])))
597599
) {
598600
inferredField = inferFromUri(key, types, _.isArray(value))

0 commit comments

Comments
 (0)