amdubay / pet-adoption

0 stars 0 forks source link

Fix duplicate results issue #5

Closed amdubay closed 1 year ago

amdubay commented 1 year ago

The issue is not persistent, but occasionally, I'll see the same dog in the search results twice.

Fixing the double load issue might fix this issue, however, if the double load issue were the culprit, I would expect there to be multiple duplicate dogs based on the double load.

For example, when duplicate dogs show up, I would expect the double load to cause results like so: [max, sally, fluffy, scout, max, sally fluffy, scout, ...] however, the actual duplicate issue is more like [max, sally, fluffy, scout, scout, rocky, pearl, lucky]

I suspect this may be due to the paginated way petfinder's api works, and that it is necessary to create a check to filter out duplicates by .id

amdubay commented 1 year ago

See Commit 84bb9e49d8b5cb3b9fbb5c5cef581054f681e2cb

Fixed Duplicate results issue/ and duplicate api calls Tracked down that duplicate results is due to petfinders api service, so I'd need to handle duplicates on my end.

Created filter on petList component to remove duplicates.

Also, corrected VisibilitySensor to on trigger when the element comes in to view. Previously, it would trigger when it came in to view, which would load more pets, pushing the element out of view, which would trigger again.