Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jibz-Mysten committed May 25, 2023
1 parent 9383238 commit 220d1e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion apps/core/src/hooks/useTimeAgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export function useTimeAgo(options: TimeAgoOptions) {

useEffect(() => {
if (!timeFrom || !intervalEnabled) return;
console.log('interval enabled');
const timeout = setInterval(
() => setNow(Date.now()),
TimeUnit.ONE_SECOND
Expand Down
8 changes: 2 additions & 6 deletions apps/explorer/src/components/checkpoints/CheckpointsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ export function CheckpointsTable({
queryKey: ['checkpoints', 'count'],
queryFn: () => rpc.getLatestCheckpointSequenceNumber(),
});
// cursor should be the sequence number of the last checkpoint + 1 if we want to query with desc. order
const initialCursorPlusOne = Number(initialCursor) + 1;
const checkpoints = useGetCheckpoints(
initialCursorPlusOne.toString(),
limit
);

const checkpoints = useGetCheckpoints(initialCursor, limit);

const { data, isFetching, pagination, isLoading, isError } =
useCursorPagination(checkpoints);
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/src/hooks/useGetCheckpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function useGetCheckpoints(
const rpc = useRpcClient();

return useInfiniteQuery(
['get-checkpoints', limit],
['get-checkpoints', limit, cursor],
async ({ pageParam }) =>
await rpc.getCheckpoints({
descendingOrder: true,
Expand Down
9 changes: 6 additions & 3 deletions apps/explorer/src/pages/epochs/EpochDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ export default function EpochDetail() {
epochData.endOfEpochInfo
);

// cursor should be the sequence number of the last checkpoint + 1 if we want to query with desc. order
const initialCursorPlusOne = epochData.endOfEpochInfo?.lastCheckpointId
? (Number(epochData.endOfEpochInfo?.lastCheckpointId) + 1).toString()
: undefined;

return (
<div className="flex flex-col space-y-16">
<div className="grid grid-flow-row gap-4 sm:gap-2 md:flex md:gap-6">
Expand Down Expand Up @@ -139,9 +144,7 @@ export default function EpochDetail() {
<TabPanels className="mt-4">
<TabPanel>
<CheckpointsTable
initialCursor={
epochData.endOfEpochInfo?.lastCheckpointId
}
initialCursor={initialCursorPlusOne}
maxCursor={epochData.firstCheckpointId}
initialLimit={20}
/>
Expand Down

0 comments on commit 220d1e0

Please sign in to comment.