Alright, I got it working (or hacked, maybe):
return {
read(cachedValue, args) {
const { isReference, variables, field } = args;
// const field = readField(fieldName);
if (!isReference(field) && hasClientDirective(field)) {
const variableString = Object.values(variables).join();
const dataForFen = data[variableString];
return dataForFen[fieldName];
} else {
return cachedValue;
}
},
};
Turns out that the field
is passed in as an argument to read. I’m not sure about the cachedValue
, though.