From 29c81708b1930f1ed6584ceebe842ab6cc2285ee Mon Sep 17 00:00:00 2001 From: Guillaume Coupelant Date: Tue, 8 Mar 2016 17:50:23 +0100 Subject: [PATCH] fix(type): resolve null id on optionnal fields --- src/type/type.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/type/type.js b/src/type/type.js index 7bf3c40..fc0373b 100644 --- a/src/type/type.js +++ b/src/type/type.js @@ -235,7 +235,7 @@ export default function getType(graffitiModels, {name, description, fields}, pat type: reference, resolve: addHooks((rootValue, args, info) => { const resolver = getOneResolver(graffitiModels[reference]); - return resolver(rootValue, {id: rootValue[name].toString()}, info); + return resolver(rootValue, {id: rootValue[name] ? rootValue[name].toString() : null}, info); }, hooks) }; }