···472472 } else {
473473 setSelectedCollections(prev => [...prev, collection]);
474474 }
475475+ // Reset display count when changing collections
476476+ setDisplayCount(25);
475477 // We don't need to manually refresh here since we added a useEffect hook
476478 // that watches for changes to selectedCollections
477479 };
···479481 // Select all collections
480482 const selectAllCollections = () => {
481483 setSelectedCollections([...collections]);
484484+ // Reset display count when changing collections
485485+ setDisplayCount(25);
482486 // We don't need to manually refresh here since we added a useEffect hook
483487 // that watches for changes to selectedCollections
484488 };
···486490 // Deselect all collections
487491 const deselectAllCollections = () => {
488492 setSelectedCollections([]);
493493+ // Reset display count
494494+ setDisplayCount(25);
489495 // No need to refresh as we'll show "no collections selected" message
490496 };
491497···496502497503 // Set a loading state but not for the chart
498504 setLoading(true);
505505+506506+ // Reset display count to show only the first 25 records after refresh
507507+ setDisplayCount(25);
499508500509 try {
501510 // Fetch just the most recent records for the feed display
···582591 // First check if we already have more records locally that we can show
583592 if (hasMoreRecordsLocally) {
584593 console.log("Loading more records from local cache");
585585- // Simply increase the number of displayed records
586586- const currentDisplayCount = filteredRecords.length;
594594+ // Simply increase the display count by 25 more records
587595 const nextBatchSize = 25;
588588-589589- // Store the new count so our filteredRecords computation shows more records
590590- setRecords(prev => {
591591- // Create a dummy array of the right length to control how many records are shown
592592- return Array(currentDisplayCount + nextBatchSize).fill(null);
593593- });
596596+ setDisplayCount(prevCount => prevCount + nextBatchSize);
597597+ console.log(`Increasing display count to ${displayCount + nextBatchSize}`);
594598595599 setFetchingMore(false);
596600 }
···602606603607 if (collectionsToLoad.length > 0) {
604608 await fetchCollectionRecords(did, serviceEndpoint, collectionsToLoad, true);
609609+ // After fetching more, we can increase the display count to show them
610610+ setDisplayCount(prevCount => prevCount + 25);
605611 } else {
606612 setFetchingMore(false);
607613 }
···616622 selectedCollections.includes(record.collection)
617623 );
618624619619- // For timeline display, directly use the chart records but limit to most recent 25
625625+ // State to track how many records to display
626626+ const [displayCount, setDisplayCount] = useState(25);
627627+628628+ // For timeline display, directly use the chart records but limit to the current displayCount
620629 // This ensures we always show the most recent records for the selected collections
621621- // regardless of what was initially loaded in the records state
622630 const filteredRecords = filteredChartRecords
623631 .sort((a, b) => {
624632 // Sort by timestamp (newest first)
···626634 const bTime = useRkeyTimestamp ? b.rkeyTimestamp : b.contentTimestamp;
627635 return new Date(bTime) - new Date(aTime);
628636 })
629629- .slice(0, fetchingMore ? records.length : 25); // Show 25 records initially, more when loading more
637637+ .slice(0, displayCount); // Show based on displayCount state
630638631639 // Check if more records can be loaded - either from API or from our existing dataset
632640 const hasMoreRecordsLocally = filteredChartRecords.length > filteredRecords.length;