Add default limit when fetching records (#14532)

- set default limit on front find many hooks
- use default constant in rest api find many endpoint
- set a max limit in rest api find many endpoint
This commit is contained in:
Etienne
2025-09-17 10:32:47 +02:00
committed by GitHub
parent 61b9d82950
commit dc435a7946
13 changed files with 38 additions and 21 deletions
@@ -3,7 +3,10 @@ import { renderHook, waitFor } from '@testing-library/react';
import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState';
import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext';
import gql from 'graphql-tag';
import { QUERY_MAX_RECORDS } from 'twenty-shared/constants';
import {
QUERY_DEFAULT_LIMIT_RECORDS,
QUERY_MAX_RECORDS,
} from 'twenty-shared/constants';
import { generateEmptyJestRecordNode } from '~/testing/jest/generateEmptyJestRecordNode';
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
import { useEmailThreadInCommandMenu } from '../useEmailThreadInCommandMenu';
@@ -309,7 +312,7 @@ const mocks = [
filter: { messageId: { in: ['1', '2'] }, role: { eq: 'from' } },
orderBy: undefined,
lastCursor: undefined,
limit: undefined,
limit: QUERY_DEFAULT_LIMIT_RECORDS,
},
},
result: jest.fn(() => ({