This is a weird issue: though being sorted in alphabetical order, the "Google Assistant" item is always displayed at the start. I tried to debug and find the cause using some console.logs, some points to note:
There is no issue in the sort() function, all items are being sorted correctly, as expected (in alphabetical order) once the sorting has finished. The Google Assistant item is in its appropriate position.
In the map() function, somehow, the Google Assistant item is always the first item to be mapped. This is very unexpected as map() should, and does, start mapping from the first element in the array it is mapping.
Any ideas?
It's because the sorting algorithm returns a boolean, not a positive / negative value - see comparFunction docs
I just checked locally, and adding ? 1 : -1 to both alphabetical cases fixed the issue.
@vikaspotluri123 Great! I'll add the changes and push it to the repo, unless you want to create a PR? 馃槃
I'm working on frontend perf right now, so feel free to push directly to master 馃憤
Weirdly, I'm facing this issue only on mobile. 馃
Weirdly, I'm facing this issue only on mobile. 馃
It's a firefox vs chrome bug for me
Most helpful comment
It's because the sorting algorithm returns a boolean, not a positive / negative value - see comparFunction docs
I just checked locally, and adding
? 1 : -1to both alphabetical cases fixed the issue.