Hi All I am referencing few js files using static resource in Aura Component. And those js files are intialising a search box and will make that search box functional. However as soon as I click on the search box it gives the error: Uncaught TypeError: this.t[e.type] is not a function. And I am aware that this error is coming from the js file that is referenced but I am not sure how to debug this issue. Any pointers will be really helpful. Thanks Adding the afterScriptsLoaded code below scriptsLoaded : function(component, event, helper) { console.log('Scripts loaded successfully'); const { algoliasearch, instantsearch } = window; const searchClient = algoliasearch( 'B1G2GM9NG0', 'aadef574be1f9252bb48d4ea09b5cfe5' ); const search = instantsearch({ indexName: 'demo_ecommerce', searchClient, }); search.addWidgets([ instantsearch.widgets.searchBox({ container: '@searchbox', }), instantsearch.widgets.hits({ container: '@hits', templates: { item: ` <article> <h1>{{@helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}</h1> </article> `, }, }), instantsearch.widgets.pagination({ container: '@pagination', }), ]); search.start(); }
P.S: @ in code should be replaced with hash symbol. trailhead was throwing error in using the hash
Hi,
Aura Component, right?
I think you need ":" after function.
function(component, event, helper) { console.log('Scripts loaded successfully'); const { algoliasearch, instantsearch } = window; const searchClient = algoliasearch( 'B1G2GM9NG0', 'aadef574be1f9252bb48d4ea09b5cfe5' ); const search = instantsearch({ indexName: 'demo_ecommerce', searchClient, }); search.addWidgets([ instantsearch.widgets.searchBox({ container: '@searchbox', }), instantsearch.widgets.hits({ container: '@hits', templates: { item: ` <article> <h1>{{@helpers.highlight}}{ "attribute": "name" } {{/helpers.highlight}}</h1> </article> `, }, }), instantsearch.widgets.pagination({ container: '@pagination', }), ]); search.start(); }