Skip to content

Commit

Permalink
Merge pull request #214 from ecency/bugfix/wallet-history
Browse files Browse the repository at this point in the history
Fixed the transactions query in wallet
  • Loading branch information
feruzm authored Dec 23, 2024
2 parents 2c04b7e + d7425a2 commit 6f7f1c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/api/queries/get-transactions-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const getTransactionsQuery = (

return mapped.filter((x) => x !== null).sort((a: any, b: any) => b.num - a.num);
},
staleTime: 60000,
initialData: { pages: [], pageParams: [] },
initialPageParam: -1,
getNextPageParam: (_, __, lastPageParam) => lastPageParam + limit
getNextPageParam: (lastPage, __) =>
lastPage ? (lastPage[lastPage.length - 1].num ?? 0) - 1 : -1
});
3 changes: 2 additions & 1 deletion src/app/(dynamicPages)/profile/[username]/wallet/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAccountFullQuery } from "@/api/queries";
import { getAccountFullQuery, getTransactionsQuery } from "@/api/queries";
import { notFound } from "next/navigation";
import { WalletHive } from "../_components";
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
Expand All @@ -18,6 +18,7 @@ export async function generateMetadata(props: Props, parent: ResolvingMetadata):
export default async function EnginePage({ params }: Props) {
const { username } = await params;
const account = await getAccountFullQuery(username.replace("%40", "")).prefetch();
await getTransactionsQuery(username, 20).prefetch();

if (!account) {
return notFound();
Expand Down

0 comments on commit 6f7f1c4

Please sign in to comment.