You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if you want to revive your custom scalars from the persisted Cache (https://github.com/apollographql/apollo-cache-persist) (where it is saved as stringified JSON), you can use the JSON.parse function with a revive method.
I am using it as such:
import{DateTime}from'luxon';// Works for keys like createdAt, updatedAt and timestamp.exportconstparseJsonWithDateTime=(jsonString: string,keyCheckFunctions: Array<(key: string)=>boolean>=[(key)=>key==='timestamp',(key)=>key.endsWith('At'),],)=>{returnJSON.parse(jsonString,(key,value)=>{for(constkeyCheckFunctionofkeyCheckFunctions){if(keyCheckFunction(key)){returnDateTime.fromISO(value);}}});};
To enable custom scalar type generation with the newest apollo codegen, you can use the following setup for codegen.yml
I am not so sure about the two options here passthroughCustomScalars: true and customScalarFormat: 'passthrough' but they don't break it.
Hi all,
if you want to revive your custom scalars from the persisted Cache (https://github.com/apollographql/apollo-cache-persist) (where it is saved as stringified JSON), you can use the JSON.parse function with a revive method.
I am using it as such:
To enable custom scalar type generation with the newest apollo codegen, you can use the following setup for codegen.yml
I am not so sure about the two options here
passthroughCustomScalars: true
andcustomScalarFormat: 'passthrough'
but they don't break it.Hope it helps someone.
The text was updated successfully, but these errors were encountered: