0

I'm developing a search engine for movies and am using the OMDB API to fetch data. Unfortunately, the API is returning duplicate searches as mentioned here: https://github.com/Omertron/api-omdb/issues/16 and thus my search engine is also returning duplicate results.

I'm using a FlatList to render the movies and using the imdbID as the key. I'm receiving a warning for keys not being unique(which I should as I just mentioned how the results are duplicated)

My question is: Is there a way to have my FlatList not render a duplicate item(using the item key). Does a built in prop or function exist specifically for this problem For each search, I might be able to store the imdbID in an idArray and not render the item if the id exists in the idArray but I reckon that would significantly slow down the search engine as the FlatList can easily contain over 3000 items for any specific search.

Ali
  • 484
  • 3
  • 5
  • 16
  • No, there's no built in prop to handle this case. You can have a look at the official documentation for flatlist https://facebook.github.io/react-native/docs/flatlist. – Vamsi Calpakkam Jan 29 '20 at 23:00
  • why are you rendering 3000 items in one go ? you should limit that and try using some sort of pagination – Gaurav Roy Jan 30 '20 at 05:32
  • Thanks. I'm now using pagination. 10 items at a time. It's faster but it has made finding duplicate results even more complicated as now duplicate movies might be on different pages. It's also super slow. Any ideas? – Ali Feb 02 '20 at 23:42

0 Answers0