Hello, I’d like for my development process to be completely divorced from the backend right now. Is there a way to configure FieldPolicy’s so that my mutations are handled entirely through the client-side cache? For example, a mutation that adds a rocket to a list of rockets. Do I need a typePolicy for the mutation AddRocket?
A small codesanbox with a single type, query, and mutation is here: https://codesandbox.io/s/empty-hill-5huhr
For example
new InMemoryCache({
typePolicies: {
Rocket: {
fields: {
description: {
read() {
return "Placeholder rocket description";
}
}
}
},
Query: {
fields: {
allRockets: {
read() {
// make some random rockets
const result = Array.from(Array(2).keys()).map((_, index) => ({
description: `Placeholder ${index}`,
id: `key-${index}`,
type: `Big Rocket #${index}`
}));
console.log(result);
return result;
}
}
}
},
Mutation: {
fields: {
AddRocket: {
read(_, { args }) {} // what goes here???
}
}
}
}
})
I see that there has been some discussion of this topic elsewhere in the past, but that discussion is currently unresolved: https://spectrum.chat/apollo/apollo-client/how-to-use-mutations-with-local-only-fields~faa0c796-8f10-4c13-bae1-be7fe559c5fa