[ECO-2169] Fix animations by updating the component keys
for the emoji grid items
#238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The animations got screwed up a bit back when I was fixing the lack of a grid line when search emojis are used.
I added the
index
to each grid item component key, meaning it re-animates any time its position in the grid changes, but that's not what we want, because for bump order in particular, the animations are set up to be triggered by changes to theorderedGrid
variable, not the component key. (They're set up this way byframer-motion
, which animates the grid order, indicated by the presence of thelayout
prop in an animated component)In order to fix this bug while still respecting the original fix, I've added the
searchEmojis
to the component keys and removed theindex
from the component key.Thus the
searchEmojis
changing will trigger a re-render, which subsequently forces the component to re-checks if the grid line on its left should be present. However, if the grid re-orders due to thebumpOrder
changing, the component will animate properly because its key will remain the same, since theindex
is no longer in the key.Testing
Tested it on the
production
branch to visually ensure things are working as expected now, but the fixes can go in right now tomain
and will work as expected down the road when everything is set upChecklist