Skip to content

Commit

Permalink
add a variable for page size
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Oct 26, 2024
1 parent abaf86e commit 7b7b6bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/AddPeopleToTag/AddPeopleToTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { Modal, Form, Button } from 'react-bootstrap';
import { useParams } from 'react-router-dom';
import type { InterfaceQueryUserTagsMembersToAssignTo } from 'utils/interfaces';
import styles from './AddPeopleToTag.module.css';
import { dataGridStyle } from 'utils/organizationTagsUtils';
import {
ADD_PEOPLE_TO_TAGS_QUERY_LIMIT,
dataGridStyle,
} from 'utils/organizationTagsUtils';
import { Stack } from '@mui/material';
import { toast } from 'react-toastify';
import { ADD_PEOPLE_TO_TAG } from 'GraphQl/Mutations/TagMutations';
Expand Down Expand Up @@ -80,15 +83,15 @@ const AddPeopleToTag: React.FC<InterfaceAddPeopleToTagProps> = ({
} = useQuery(USER_TAGS_MEMBERS_TO_ASSIGN_TO, {
variables: {
id: currentTagId,
first: 7,
first: ADD_PEOPLE_TO_TAGS_QUERY_LIMIT,
},
skip: !addPeopleToTagModalIsOpen,
});

const loadMoreMembersToAssignTo = (): void => {
fetchMoreMembersToAssignTo({
variables: {
first: 7, // Load 7 more items
first: ADD_PEOPLE_TO_TAGS_QUERY_LIMIT,
after:
userTagsMembersToAssignToData?.getUserTag.usersToAssignTo.pageInfo
.endCursor, // Fetch after the last loaded cursor
Expand Down
2 changes: 2 additions & 0 deletions src/utils/organizationTagsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ export const dataGridStyle = {
borderRadius: '0.1rem',
},
};

export const ADD_PEOPLE_TO_TAGS_QUERY_LIMIT = 7;

0 comments on commit 7b7b6bf

Please sign in to comment.