Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
antriksh-9 committed Dec 13, 2024
1 parent 0925a4e commit 1965a0a
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/screens/Users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,16 @@ const Users = (): JSX.Element => {
}: {
data?: { users: InterfaceQueryUserListItem[] };
loading: boolean;
fetchMore: any;
refetch: any;
fetchMore: (options: {
variables: Record<string, unknown>;
updateQuery: (
previousQueryResult: { users: InterfaceQueryUserListItem[] },
options: {
fetchMoreResult?: { users: InterfaceQueryUserListItem[] };
},
) => { users: InterfaceQueryUserListItem[] };
}) => void;
refetch: (variables?: Record<string, unknown>) => void;
error?: ApolloError;
} = useQuery(USER_LIST, {
variables: {
Expand Down Expand Up @@ -171,9 +179,11 @@ const Users = (): JSX.Element => {
setHasMore(true);
};

const handleSearchByEnter = (e: any): void => {
const handleSearchByEnter = (
e: React.KeyboardEvent<HTMLInputElement>,
): void => {
if (e.key === 'Enter') {
const { value } = e.target;
const { value } = e.target as HTMLInputElement;
handleSearch(value);
}
};
Expand Down Expand Up @@ -211,16 +221,16 @@ const Users = (): JSX.Element => {
{
fetchMoreResult,
}: {
fetchMoreResult: { users: InterfaceQueryUserListItem[] } | undefined;
fetchMoreResult?: { users: InterfaceQueryUserListItem[] };
},
): { users: InterfaceQueryUserListItem[] } | undefined => {
) => {
setIsLoadingMore(false);
if (!fetchMoreResult) return prev;
if (!fetchMoreResult) return prev || { users: [] };
if (fetchMoreResult.users.length < perPageResult) {
setHasMore(false);
}
return {
users: [...(prev?.users || []), ...(fetchMoreResult.users || [])],
users: [...(prev?.users || []), ...fetchMoreResult.users],
};
},
});
Expand Down

0 comments on commit 1965a0a

Please sign in to comment.