File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments