Skip to content

Commit

Permalink
fix(index): expose getResults instead of getDerivedHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Jul 22, 2019
1 parent da1d45d commit 347ebbb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/widgets/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import algoliasearchHelper, {
AlgoliaSearchHelper as Helper,
DerivedHelper,
PlainSearchParameters,
SearchResults,
} from 'algoliasearch-helper';
import {
InstantSearch,
Expand Down Expand Up @@ -30,7 +31,7 @@ type IndexProps = {
export type Index = Widget & {
getIndexId(): string;
getHelper(): Helper | null;
getDerivedHelper(): DerivedHelper | null;
getResults(): SearchResults | null;
getParent(): Index | null;
getWidgets(): Widget[];
addWidgets(widgets: Widget[]): Index;
Expand Down Expand Up @@ -70,7 +71,7 @@ function resolveScopedResultsFromWidgets(widgets: Widget[]): ScopedResult[] {
return scopedResults.concat(
{
indexId: current.getIndexId(),
results: current.getDerivedHelper()!.lastResults!,
results: current.getResults()!,
},
...resolveScopedResultsFromWidgets(current.getWidgets())
);
Expand Down Expand Up @@ -109,8 +110,8 @@ const index = (props: IndexProps): Index => {
return helper;
},

getDerivedHelper() {
return derivedHelper;
getResults() {
return derivedHelper && derivedHelper.lastResults;
},

getParent() {
Expand Down

0 comments on commit 347ebbb

Please sign in to comment.