Skip to content

Instantly share code, notes, and snippets.

@helielson
Created October 23, 2019 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helielson/101568a530eb68301ddb95ae03e58393 to your computer and use it in GitHub Desktop.
Save helielson/101568a530eb68301ddb95ae03e58393 to your computer and use it in GitHub Desktop.
const missingHandlerByRefConcreteTypeField: MissingFieldHandler = {
kind: 'linked',
handle(field, _, argValues) {
try {
const argsString =
field.args && field.args.length
? `{${field.args.map(a => `"${a.name}":"${argValues[a.name]}"`).join(',')}}`
: null;
const idValue = [field.concreteType, argsString].filter(v => !!v).join(':');
return base64.encode(idValue);
} catch (e) {
// it wasn't be possible to transform the field ref
}
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment