Bug breaks left/right hotkeys

I believe this is a bug in LingQ’s rendering logic which causes hotkeys to stop responding.

When reading a lesson using the left and right keyboard hotkeys, sometimes I hit a word that causes this error to appear on DevTools console, and the left and right hotkeys stop responding. It is reliably triggered by that same word. I can refresh the browser window to fix the hotkeys, but as soon as I highlight that word again, the error happens again, and hotkeys are broken.

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'index')
    at main-329afa4cfc6efd30fd22.js:2:5103749

The relevant line of code, in context, is: (this is from DevTools’ prettified view of the minified JS)

            }, {
                key: "renderRelatedPhrases",
                value: function(t, a, n) {
                    var i = this
                      , o = t.map((function(e) {
                        var t = e.normalizedTerm;
                        return (0,
                        r.termWords)(t)
                    }
                    )).map((function(e) {
                        var t = i.postings.relatedPhraseLocation(e, a, n).index; // <-- this is the line that throws the error
                        return {
                            start: t,
                            end: t + e.length - 1
                        }
                    }
                    ))
2 Likes

Thanks, we will look into it.

1 Like