Fixed bug with record without activity target (#7175)

Fixed bug that was appearing with records without any activity target

The problem may come from the new TwentyORM that doesn't understand the
filter like before.
This commit is contained in:
Lucas Bordeau
2024-09-20 12:53:29 +02:00
committed by GitHub
parent ebf677809a
commit 0aa48fb1e4

View File

@ -51,13 +51,12 @@ export const useActivities = <T extends Task | Note>({
),
];
const skipBecauseNoActivityTargetFound = activityIds.length === 0;
const filter: RecordGqlOperationFilter = {
id:
targetableObjects.length > 0
? {
in: activityIds,
}
: undefined,
id: {
in: activityIds,
},
...activitiesFilters,
};
@ -69,7 +68,7 @@ export const useActivities = <T extends Task | Note>({
const { records: activities, loading: loadingActivities } =
useFindManyRecords<Task | Note>({
skip: skip || loadingActivityTargets,
skip: skip || loadingActivityTargets || skipBecauseNoActivityTargetFound,
objectNameSingular:
FIND_ACTIVITIES_OPERATION_SIGNATURE.objectNameSingular,
recordGqlFields: FIND_ACTIVITIES_OPERATION_SIGNATURE.fields,