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

Using v3.0.0-alpha.40, Uncaught TypeError: t is undefined #1049

Closed
faunaee opened this issue Sep 22, 2021 · 2 comments
Closed

Using v3.0.0-alpha.40, Uncaught TypeError: t is undefined #1049

faunaee opened this issue Sep 22, 2021 · 2 comments

Comments

@faunaee
Copy link

faunaee commented Sep 22, 2021

Description

When I use the alpha 40, I get the following error in my browser console, and no searching occurs:

Uncaught TypeError: t is undefined
    ke https://cdn.jsdelivr.net/npm/@docsearch/js@alpha:6
    <anonymous> https://cdn.jsdelivr.net/npm/@docsearch/js@alpha:6
    <anonymous> http://127.0.0.1:8080/path/to/page.html:1858

Steps to reproduce

Per the README, I added the following line to my HTML:

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@alpha"></script>

And then I initialize docsearch with:

<script>
var algoliaSearch = docsearch({
  appId: '{{config.algolia-app-id}}',
  apiKey: '{{config.algolia-api-key}}',
  indexName: '{{config.algolia-idx-name}}',
  inputSelector: '#algolia-input',
  autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
  algoliaOptions: { hitsPerPage: 10 },
  debug: false
}).autocomplete
algoliaSearch.on('autocomplete:closed', function () { algoliaSearch.autocomplete.setVal() })
</script>

Then I the affected page in my browser. That's when the error appears in the console.

When I fetch the version 2 of docsearch, using the following line, no error occurs:

<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>

Live reproduction:

https://codesandbox.io/s/admiring-surf-1dwqk?file=/index.html

Unfortunately, codesandbox clears the console very shortly after the error is emitted.

Expected behavior

The docsearch alpha should work: I should be able to search my index without a showstopping error.

Environment

  • OS: macOS
  • Browser: Chrome & Firefox
  • DocSearch version: 3.0.0-alpha.40
@shortcuts
Copy link
Member

Hey @faunaee!

And then I initialize docsearch with:

This code snippet will only work with DocSearch v2 (docsearch.js@2), which is on the master branch of this repository: https://github.com/algolia/docsearch/tree/master, and documented on https://docsearch.algolia.com/

Per the README, I added the following line to my HTML:

This is the import for DocSearch v3, which is on the next branch of this repository: https://github.com/algolia/docsearch and soon documented! You can see the progress on this PR: #1048

To make DocSearch v3 work, you can check our examples, those React and JavaScript codesandboxes or browse the preview of the new documentation on the PR above.

Hope this solves your issue :D

@faunaee
Copy link
Author

faunaee commented Sep 27, 2021

Thanks for pointing me in the right direction, and apologies for the noise.

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