Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of null (onKeyDown.js) #1246

Open
amureki opened this issue Apr 10, 2024 · 1 comment
Open

TypeError: Cannot read properties of null (onKeyDown.js) #1246

amureki opened this issue Apr 10, 2024 · 1 comment

Comments

@amureki
Copy link

amureki commented Apr 10, 2024

Description

Greetings dear fellows.

We did set up Algolia search autocomplete with the help of @algolia/autocomplete-js. It is quite similar to what is defined in the query suggestions sandbox example from your docs.

It is rolled out in one of our services and works, however we are noticing cryptic errors coming from the library code.
We cannot reproduce it and it happens quite occasionally.
Sentry gives us the following traceback:

TypeError: Cannot read properties of null (reading 'item')
  at <anonymous>(./node_modules/@algolia/autocomplete-core/dist/esm/onKeyDown.js:116:20)
  at <object>.onKeyDown(./node_modules/@algolia/autocomplete-core/dist/esm/getPropGetters.js:179:9)
  at <object>.onKeyDown(./node_modules/@algolia/autocomplete-js/dist/esm/elements/Input.js:36:18)
  at eventProxy(./node_modules/@algolia/autocomplete-js/dist/esm/utils/setProperties.js:30:25)

Reproduction

Couldn't yet.

Expected behavior

No errors coming from the library.

Environment

  • OS: Windows >= 10
  • Browser: Edge 122.0.0, Firefox 124.0, Chrome 122.0.0, Edge 120.0.0
  • Autocomplete version: 1.17.0
@Haroenv
Copy link
Contributor

Haroenv commented Apr 15, 2024

To start unpacking this behaviour, it seems to be linked to this line: https://github.com/algolia/autocomplete/blob/next/packages/autocomplete-core/src/onKeyDown.ts#L146 where somehow getActiveItem returns null, although I don't know how that can happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants