Skip to content

Commit c9fa944

Browse files
committed
use initial items
1 parent 7caefaf commit c9fa944

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

pages/maps/+Page.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ export function Page() {
2626

2727
const key = input + activeOnly + recentOrder;
2828

29-
const baseParams = useMemo(() => {
30-
//const lastYear = sources?.[sources.length - 1]?.ref_year || 9999;
31-
//const lastId = sources?.[sources.length - 1]?.source_id || 0
32-
const lastYear = 9999;
33-
const lastId = 0;
34-
35-
console.log("Last year:", lastYear);
36-
console.log("Last ID:", lastId);
29+
const initialItems = recentOrder && input === "" ? sources : [];
3730

31+
const baseParams = useMemo(() => {
32+
const lastYear = initialItems.length > 0 ?
33+
initialItems[initialItems.length - 1]?.ref_year : 9999;
34+
const lastId = initialItems.length > 0 ?
35+
initialItems[initialItems.length - 1]?.source_id : 0
36+
3837
return {
3938
is_finalized: activeOnly ? "eq.true" : undefined,
4039
status_code: activeOnly ? "eq.active" : undefined,
@@ -113,7 +112,7 @@ export function Page() {
113112
route: `${apiDomain}/api/pg/sources_metadata`,
114113
getNextParams,
115114
hasMore,
116-
// initialItems: sources,
115+
initialItems,
117116
itemComponent: SourceItem,
118117
key,
119118
delay: 100

0 commit comments

Comments
 (0)