clearRefinements connector and success/failure callbacks - how to run code after refinements are cleared?

I am using the clearRefinements connector to create my own clear button and then call refine(); This is basically straight out of the documentation here (code below): clearRefinements | InstantSearch.js | Algolia

However, i want to be able to “do something” after the clearRefinements function is complete. Can anyone help me figure out how to have a promise hang off the success/failure of the refine() function that is called as part of the clearRefinements connector?

// Create the render function
const renderClearRefinements = (renderOptions, isFirstRender) => {
  const { canRefine, refine, widgetParams } = renderOptions;

  if (isFirstRender) {
    const button = document.createElement('button');
    button.textContent = 'Clear refinements';

    button.addEventListener('click', () => {


  widgetParams.container.querySelector('button').disabled = !canRefine;

// Create the custom widget
const customClearRefinements = instantsearch.connectors.connectClearRefinements(

// Instantiate the custom widget
    container: document.querySelector('#clear-refinements'),

I need this also… Please help us