I can reproduce. Follows the stack trace:
_application-bfbda341c2eb6dd7d61c681e17bdccec057c30e045ddc332927a7363150e9b1b.js:16386 Uncaught TypeError: Cannot read property '0' of null
at HTMLLIElement.<anonymous> (application-bfbda341c2eb6dd7d61c681e17bdccec057c30e045ddc332927a7363150e9b1b.br.js:1)
at HTMLLIElement.dispatch (ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.br.js:1)
at HTMLLIElement.d.handle (ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.br.js:1)
(anonymous) @ application-bfbda341c2eb6dd7d61c681e17bdccec057c30e045ddc332927a7363150e9b1b.br.js:1
dispatch @ ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.br.js:1
d.handle @ ember_jquery-36a23101c869ab0dc53fc908de69adb785731593573d32bdeef416acc1076ef4.br.js:1
That is this line
Error happens because selectedOption
is 0 (single suggestion aka the first) while autocompleteOptions
is somehow null.
Investigating why now…
So I’m not sure why so far. At first I was suspecting this PR from @Osama
https://github.com/discourse/discourse/pull/11637
But I added quite a few breakpoints and can’t really find “who” is mutating autocompleteOptions
and setting it as null.
Having autocompleteOptions
be from the scope of the parent closure from two levels up is also quite weird and makes the code a bit hard to follow up/debug.