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

Conversation

iskounen
Copy link
Contributor

@iskounen iskounen commented Jan 14, 2025

This PR updates Infinite Discovery to use the discoverArtwork query (with refetch) to create an infinite scroll.

Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-01-16.at.15.02.11.mp4

Some outstanding issues to be followed-up on:

  1. I am showing a spinner when the next batch starts to load, but ideally the refetch won't trigger a redraw.
  2. I am not persisting the artworks that a user has seen, so users will see the same artworks across multiple sessions.

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

Dev changes

  • Infinite Discovery updated to refetch batches of 5 artworks

Need help with something? Have a look at our docs, or get in touch with us.

@iskounen iskounen requested a review from araujobarret January 14, 2025 18:59
@iskounen iskounen self-assigned this Jan 14, 2025
@iskounen iskounen marked this pull request as draft January 14, 2025 18:59
@iskounen iskounen changed the title feat(DIA-1015): paginate infinite discovery feat(DIA-1062): refetch infinite discovery Jan 15, 2025
@iskounen iskounen force-pushed the iskounen/feat/infinite-discovery-pagination branch from 900ef37 to 0959c32 Compare January 16, 2025 20:15
@iskounen iskounen marked this pull request as ready for review January 16, 2025 20:20
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Jan 16, 2025

This PR contains the following changes:

  • Dev changes (Infinite Discovery updated to refetch batches of 5 artworks - iskounen)

Generated by 🚫 dangerJS against babdd2b


return <InfiniteDiscovery artworks={initialData} />
},
LoadingFallback: SpinnerFallback,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LoadingFallback is displayed in two situations: when the component first loads, and when the component refetches its data. However, I want two different things to happen in those situations:

  1. When the component first loads, I want to show a skeleton loader
  2. When the component refetches its data, I don't want the component to redraw (because that should happen in the background while the user is viewing the second-to-last artwork.

cc: @araujobarret @damassi

@iskounen iskounen added the Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green label Jan 16, 2025
refetch(
{ excludeArtworkIds: artworks.map((artwork) => artwork.internalID) },
{
fetchPolicy: "network-only",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the correct fetch policy because these we are fetching artworks that should not have been "discovered" before.

@artsy-peril artsy-peril bot merged commit e0fdd7b into main Jan 16, 2025
7 checks passed
@artsy-peril artsy-peril bot deleted the iskounen/feat/infinite-discovery-pagination branch January 16, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants