## Query depth deprecation I'm deprecating depth parameter in our graphql query / cache tooling. They were obsolete since we introduce the possibility to provide RecordGqlFields ## Refactor combinedFindManyRecordHook The hook can now take an array of operationSignatures ## Fix tasks issues Fix optimistic rendering issue. Note that we still haven't handle optimisticEffect on creation properly
33 lines
946 B
TypeScript
33 lines
946 B
TypeScript
import { RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
|
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
|
import { isDefined } from '~/utils/isDefined';
|
|
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
|
|
|
import { FieldMetadataItem } from '../types/FieldMetadataItem';
|
|
|
|
export const shouldFieldBeQueried = ({
|
|
field,
|
|
recordGqlFields,
|
|
}: {
|
|
field: Pick<FieldMetadataItem, 'name' | 'type'>;
|
|
objectRecord?: ObjectRecord;
|
|
recordGqlFields?: RecordGqlOperationGqlRecordFields;
|
|
}): any => {
|
|
if (
|
|
isUndefinedOrNull(recordGqlFields) &&
|
|
field.type !== FieldMetadataType.Relation
|
|
) {
|
|
return true;
|
|
}
|
|
if (
|
|
isDefined(recordGqlFields) &&
|
|
isDefined(recordGqlFields[field.name]) &&
|
|
recordGqlFields[field.name] !== false
|
|
) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
};
|