Skip to content

Commit

Permalink
Fix issue with Fuse match indices being unsorted
Browse files Browse the repository at this point in the history
  • Loading branch information
fyrk committed Nov 26, 2023
1 parent 04d8c0c commit cf94ed6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export default function Match({
const groups = []
let group = []
let prevEnd = -1
for (let [start, end] of lyricsMatches[0].indices) {

for (let [start, end] of [...lyricsMatches[0].indices].sort(
(a, b) => a[0] - b[0],
)) {
if (start > prevEnd + 2) {
groups.push(group)
group = []
Expand Down

0 comments on commit cf94ed6

Please sign in to comment.