... item throwing error in Microsoft Edge

Dear team,

instantsearch.widgets.currentRefinements({
    container: '#current-refinements-categories',
    includedAttributes: 'categories.lvl0',
    transformItems(items) {
      console.log(items);
      return items.map(item => ({
        ...item,
        label: 'Categories',
      }));
    },
  });


[...container.querySelectorAll('a')].forEach(element => {
    element.addEventListener('click', event => {
      event.preventDefault();
      refine(event.currentTarget.dataset.value);
      console.log('load header invoked.');
             window.googletag = window.googletag || {cmd: []};
             googletag.cmd.push(function() {
                  googletag.pubads().refresh();
                  googletag.pubads().disableInitialLoad();
                  googletag.enableServices();
                 });
             checkJsReady();
    });
  });

Both code snippets mentioned above are throwing errors in Microsoft Edge version 40 (I know that the issue is fixed after version 79 ) but still we need to support the older versions.

The issue is Microsoft Edge older version doesn’t understand the ES6 spread syntax and so it is breaking our entire Algolia search page

Please do let me know how to resolve this issue

Here is the scrrenshot attached

Hi,

This seems like a Javascript issue rather than an issue related to InstantSearch itself.

Have you tried: Array.from(container.querySelectorAll('a')) instead?

Let me know if that solved your issue.
Best,

Yeah @jonathan.montane , it’s a javascript issue so I wanted to know does algolia have any quick solution mainly for …item as it is not able to spread the object

indent preformatted text by 4 spacesinstantsearch.widgets.currentRefinements({
container: '#current-refinements-categories',
includedAttributes: 'categories.lvl0',
transformItems(items) {
  console.log(items);
  return items.map(item => ({
    ...item,
    label: 'Categories',
  }));
},

});

Do let me know what can I used instead to resolve this.

Thanks

Just to let you know that this is not a forum dedicated to debugging generic javascript code. For this, please reach out on Stackoverflow instead.

I’ll still help you out this one time, but please be mindful of the time it takes us to answer these unrelated tickets:

items.map(function (item) {
  return Object.assign({}, item, { label: 'Categories'})
})

documentation: Object.assign() - JavaScript | MDN