Skip to content

Commit

Permalink
Fix leaf filling on list types
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
leebyron committed Sep 3, 2015
1 parent 976458b commit 1639bfc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utility/fillLeafs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ function buildSelectionSet(type, getDefaultFieldNames) {
return;
}

// Unwrap any non-null or list types.
var namedType = getNamedType(type);

// Get an array of field names to use.
var fieldNames = getDefaultFieldNames(type);
var fieldNames = getDefaultFieldNames(namedType);

// If there are no field names to use, return no selection set.
if (!Array.isArray(fieldNames) || fieldNames.length === 0) {
Expand All @@ -111,8 +114,8 @@ function buildSelectionSet(type, getDefaultFieldNames) {
return {
kind: 'SelectionSet',
selections: fieldNames.map(fieldName => {
var fieldDef = type.getFields()[fieldName];
var fieldType = fieldDef ? getNamedType(fieldDef.type) : null;
var fieldDef = namedType.getFields()[fieldName];
var fieldType = fieldDef ? fieldDef.type : null;
return {
kind: 'Field',
name: {
Expand Down

0 comments on commit 1639bfc

Please sign in to comment.