Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Oct 30, 2024
1 parent e71c93e commit 6c9d9c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions www/src/components/account/Invites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ function DeleteInvite({ invite }: any) {
const [mutation, { loading, error }] = useDeleteInviteMutation({
variables: { id: invite.id },
onCompleted: () => setConfirm(false),
update: (cache, { data: { deleteInvite } }) =>
update: (cache, { data }) =>
updateCache(cache, {
query: INVITES_Q,
variables: {},
update: (invites) => removeConnection(invites, deleteInvite, 'invites'),
update: (invites) =>
removeConnection(invites, data?.deleteInvite, 'invites'),
}),
})

Expand Down
9 changes: 4 additions & 5 deletions www/src/components/audits/Audits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Date, PageTitle, Table } from '@pluralsh/design-system'
import { createColumnHelper } from '@tanstack/react-table'
import isEmpty from 'lodash/isEmpty'

import { extendConnection } from '../../utils/graphql'
import { extendConnection, mapExistingNodes } from '../../utils/graphql'
import LoadingIndicator from '../utils/LoadingIndicator'

import { AuditUser } from './AuditUser'
Expand Down Expand Up @@ -136,8 +136,7 @@ export function Audits() {
fetchPolicy: 'cache-and-network',
})
const pageInfo = data?.audits?.pageInfo
const edges = data?.audits?.edges
const audits = useMemo(() => edges?.map(({ node }) => node) || [], [edges])
const audits = useMemo(() => mapExistingNodes(data?.audits), [data?.audits])

const fetchMoreOnBottomReached = useCallback(
(element?: HTMLDivElement | undefined) => {
Expand All @@ -149,10 +148,10 @@ export function Audits() {
if (
scrollHeight - scrollTop - clientHeight < FETCH_MARGIN &&
!loading &&
pageInfo.hasNextPage
pageInfo?.hasNextPage
) {
fetchMore({
variables: { cursor: pageInfo.endCursor },
variables: { cursor: pageInfo?.endCursor },
updateQuery: (prev, { fetchMoreResult: { audits } }) =>
extendConnection(prev, audits, 'audits'),
})
Expand Down

0 comments on commit 6c9d9c5

Please sign in to comment.