MrBartusek / gif-picker-react

Tenor GIF Picker component for React ⚛️
http://dokurno.dev/gif-picker-react/
MIT License
38 stars 12 forks source link

Fix picker not displaying featured categories #25

Closed MrBartusek closed 1 year ago

MrBartusek commented 1 year ago

In recent weeks Tenor reduced the number of featured categories from 58 to 57 which revealed a critical flaw in the categories rendering code.

image

Picker has a built-in system that removes a couple of last categories when they can't be divided by column count so there are not any half-filled rows at the end. This system apparently breaks when there are no columns to remove since:

categories.slice(0, -1); // removes last 1 category
categories.slice(0, -0); // removes all categories, for some reason

This PR fixes that:

image