diff --git a/src/lib/InstantSearch.js b/src/lib/InstantSearch.js index 36a71f67ee..687f6bf0f8 100644 --- a/src/lib/InstantSearch.js +++ b/src/lib/InstantSearch.js @@ -340,6 +340,7 @@ class InstantSearch extends EventEmitter { dispose() { this.removeWidgets(this.widgets); this.started = false; + this.helper = null; } createURL(params) { diff --git a/src/lib/__tests__/InstantSearch-test.js b/src/lib/__tests__/InstantSearch-test.js index ba436cb620..54b81df03d 100644 --- a/src/lib/__tests__/InstantSearch-test.js +++ b/src/lib/__tests__/InstantSearch-test.js @@ -516,6 +516,21 @@ describe('InstantSearch lifecycle', () => { expect(helperSearchSpy).toHaveBeenCalledTimes(1); expect(search.started).toBe(false); }); + + it('should set the helper to `null`', () => { + search = new InstantSearch({ + indexName, + searchClient: algoliasearch(appId, apiKey), + }); + + search.start(); + + expect(search.helper).not.toBe(null); + + search.dispose(); + + expect(search.helper).toBe(null); + }); }); it('Allows to start without widgets', () => {