Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(DIA-1062): refetch infinite discovery #11395

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed a magic number
  • Loading branch information
iskounen committed Jan 16, 2025
commit 0d01a728347161b345144c71bd9ac840f96964ab
4 changes: 3 additions & 1 deletion src/app/Scenes/InfiniteDiscovery/InfiniteDiscovery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export const InfiniteDiscovery: React.FC<InfiniteDiscoveryProps> = ({ artworks:
InfiniteDiscovery_Fragment$key
>(infiniteDiscoveryFragment, _artworks)

const REFETCH_BUFFER = 2

const { color } = useTheme()
const { width: screenWidth } = useScreenDimensions()

Expand Down Expand Up @@ -66,7 +68,7 @@ export const InfiniteDiscovery: React.FC<InfiniteDiscoveryProps> = ({ artworks:
}

// fetch more artworks when the user is about to reach the end of the list
if (index === artworks.length - 2) {
if (index === artworks.length - REFETCH_BUFFER) {
refetch(
{ excludeArtworkIds: artworks.map((artwork) => artwork.internalID) },
{
Expand Down