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

fix(web/discover): filter duplicates in pagination #3500

Conversation

marcofaggian
Copy link
Contributor

Description

Duplicates coming directly from the TMDB API, filtered at rendering time (within useDiscover) so that a cached state at the backend is not needed.

Screenshot (if UI-related)

Before
immagine

After
immagine

To-Dos

  • Successful build yarn build

Issues Fixed or Closed

Signed-off-by: marcofaggian <m@marcofaggian.com>
@sct
Copy link
Owner

sct commented Jun 12, 2023

The performance impact of code like this is too costly for what is, at most, a very minor (and inconsistent) inconvenience of seeing double.

@marcofaggian
Copy link
Contributor Author

marcofaggian commented Jun 12, 2023

@sct maybe the change is impacting too broadly?
Since the TMDB API call is returning 40 items max anyway, we could keep it specific for MovieRecommendations and TvRecommendations components.

for example:

<ListView
  items={titles.filter(
    (value, index, self) => index === self.findIndex((t) => t.id === value.id)
  )}
  isEmpty={isEmpty}
  isReachingEnd={isReachingEnd}
  isLoading={
     isLoadingInitialData || (isLoadingMore && (titles?.length ?? 0) > 0)
  }
  onScrollBottom={fetchMore}
/>

@sct
Copy link
Owner

sct commented Jun 13, 2023

I think it's the same deal. It doesn't really make sense to me to introduce this for such a minor inconvenience. And even though it's only 40 items, id rather not introduce code that's looping through each item X number of times for a problem that most of the time doesn't even appear.

@stale
Copy link

stale bot commented Aug 12, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TMDB recommendations have duplicates
2 participants