export type UseImperativeLoadableFieldReturn = { loadFragmentReference: (args: TArgs) => void; }; // Note: this function doesn't seem to work if there are additional arguments, // e.g. with set_pet_tagline. Why? This seems to straightforwardly call // exposedField(args)[1](); Odd. export function useImperativeExposedMutationField( exposedField: (args: TArgs) => [string, () => void], ): UseImperativeLoadableFieldReturn { return { loadFragmentReference: (args: TArgs) => { const [_id, loader] = exposedField(args); loader(); }, }; }