Skip to content

The open alternative to Salesforce, designed for AI.

fix: flickering when updating relation counts (#11943)

Abdul Rahmanff4db929008f
diff --git a/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx b/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
index 28d551c15a0..8b01952a361 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
@@ -102,17 +102,16 @@ export const RecordDetailRelationSection = ({
} satisfies RecordGqlOperationFilter)
: {};
- const { data: relationAggregateResult, loading: aggregateLoading } =
- useAggregateRecords<{
- id: { COUNT: number };
- }>({
- objectNameSingular: relationObjectMetadataItem.nameSingular,
- filter: filtersForAggregate,
- skip: !isToManyObjects,
- recordGqlFieldsAggregate: {
- id: [AGGREGATE_OPERATIONS.count],
- },
- });
+ const { data: relationAggregateResult } = useAggregateRecords<{
+ id: { COUNT: number };
+ }>({
+ objectNameSingular: relationObjectMetadataItem.nameSingular,
+ filter: filtersForAggregate,
+ skip: !isToManyObjects,
+ recordGqlFieldsAggregate: {
+ id: [AGGREGATE_OPERATIONS.count],
+ },
+ });
const isRecordReadOnly = useIsRecordReadOnly({
recordId,
@@ -123,7 +122,7 @@ export const RecordDetailRelationSection = ({
isRecordReadOnly,
});
- if (loading || aggregateLoading || isFieldReadOnly) return null;
+ if (loading || isFieldReadOnly) return null;
const relationRecordsCount = relationAggregateResult?.id?.COUNT ?? 0;