Skip to content

Commit

Permalink
fix: minjani history
Browse files Browse the repository at this point in the history
  • Loading branch information
tomquirk committed Jan 12, 2024
1 parent fe591f2 commit 929dec2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import { HistoricalConfigurationPanel } from './HistoricalConfigurationPanel'

export const HistorySubPanel = () => {
const { projectId } = useProjectMetadata()
const { fundingCycle } = useProjectContext()

const [isFetchingMore, setIsFetchingMore] = useState<boolean>()
const { data, fetchMore, loading, error } = usePastFundingCycles({
projectId,
currentFcNumber: fundingCycle?.number.toNumber() ?? 0,
})

const isLoading = loading || isFetchingMore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import {
useFundingCyclesQuery,
} from 'generated/graphql'
import { client } from 'lib/apollo/client'
import { useMemo } from 'react'

const DEFAULT_PAGE_SIZE = 5

export function usePastFundingCycles({
projectId,
currentFcNumber,
pageSize,
}: {
projectId: number | undefined
currentFcNumber: number | undefined
pageSize?: number
}) {
const now = useMemo(() => Math.floor(Date.now() / 1000), [])

return useFundingCyclesQuery({
client,
variables: {
where: {
projectId,
endTimestamp_lt: now, // Only already ended
number_lt: currentFcNumber,
},
orderBy: FundingCycle_OrderBy.number,
orderDirection: OrderDirection.desc,
Expand Down

0 comments on commit 929dec2

Please sign in to comment.