diff --git a/src/app/blocks/page.tsx b/src/app/blocks/page.tsx
index cfe0b48..4c867c7 100644
--- a/src/app/blocks/page.tsx
+++ b/src/app/blocks/page.tsx
@@ -20,6 +20,7 @@ const Page = () => {
queryClient.prefetchQuery({
queryFn: () => getBlocks({ endpoint, pageIndex: 0}),
queryKey: [queryName, defaultQueryOptions.pageIndex],
+ staleTime: 0,
meta: {
errorMessage,
},
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 6971777..e2e1a8b 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -57,6 +57,7 @@ export default function Home() {
queryClient.prefetchQuery({
queryFn: () => getTransactions({ endpoint: transactionEndpoint, pageIndex: 0 }),
queryKey: [transactionsQuery],
+ staleTime: 0,
meta: {
errorMessage,
},
@@ -64,12 +65,15 @@ export default function Home() {
queryClient.prefetchQuery({
queryFn: () => getBlocks({ endpoint: blocksEndpoint, pageIndex: 0 }),
queryKey: [blocksQuery],
+ staleTime: 0,
meta: {
errorMessage,
},
}),
]);
+ // console.log(queryClient)
+
return (
{
queryClient.prefetchQuery({
queryFn: () => getTransactions({ endpoint, pageIndex: 0}),
queryKey: [queryName, defaultQueryOptions.pageIndex],
+ staleTime: 0,
meta: {
errorMessage,
},
diff --git a/src/components/PreviewTable/index.tsx b/src/components/PreviewTable/index.tsx
index 8de89f6..bbe06fd 100644
--- a/src/components/PreviewTable/index.tsx
+++ b/src/components/PreviewTable/index.tsx
@@ -53,6 +53,8 @@ export function PreviewTable ({
} = useSuspenseQuery({
queryKey: [queryName],
queryFn: () => getFn({ endpoint, pageIndex }),
+ // refresh preview data every 15 seconds
+ refetchInterval: 15 * 1000,
meta: {
errorMessage,
},
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 06884f4..60f3ffe 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -17,6 +17,9 @@ const makeQueryClient = () => {
queries: {
// Direct suggestion by tanstack, to prevent over-eager refetching from the client.
staleTime: 60 * 1000,
+ // TODO: configure gcTime to take advantage of queries that never update, ie /block/ht and /transaction/hash. These can be set to Infinite, basically.
+ // not fine-tuning now because I don't want to accidentally break the other queries without further testing. Caching has already caused enough silly bugs.
+ gcTime: 5 * 60 * 1000,
},
dehydrate: {
// only successful and pending Queries are included per defaults