Skip to content

Commit

Permalink
fix type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
logeekal committed Jan 18, 2023
1 parent 1273c60 commit c9400ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class OptionsListEmbeddable extends Embeddable<OptionsListEmbeddableInput
return { dataView: this.dataView, field: this.field! };
};

private runOptionsListQuery = async (clearCache: boolean = false) => {
private runOptionsListQuery = async () => {
const {
dispatch,
getState,
Expand Down Expand Up @@ -312,9 +312,6 @@ export class OptionsListEmbeddable extends Embeddable<OptionsListEmbeddableInput
mode: 'absolute' as 'absolute',
}
: globalTimeRange;
if (clearCache) {
this.optionsListService.clearOptionsListCache();
}
const { suggestions, invalidSelections, totalCardinality, rejected } =
await this.optionsListService.runOptionsListRequest(
{
Expand Down Expand Up @@ -414,7 +411,8 @@ export class OptionsListEmbeddable extends Embeddable<OptionsListEmbeddableInput
};

reload = (clearCache: boolean = false) => {
this.runOptionsListQuery(clearCache);
if (clearCache) this.optionsListService.clearOptionsListCache();
this.runOptionsListQuery();
};

public destroy = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ let optionsListRequestMethod = async (request: OptionsListRequest, abortSignal:
)
);

const clearOptionsListCacheMock = () => {};

export const replaceOptionsListMethod = (
newMethod: (request: OptionsListRequest, abortSignal: AbortSignal) => Promise<OptionsListResponse>
) => (optionsListRequestMethod = newMethod);

export const optionsListServiceFactory: OptionsListServiceFactory = () => {
return {
runOptionsListRequest: optionsListRequestMethod,
clearOptionsListCache: clearOptionsListCacheMock,
};
};

0 comments on commit c9400ba

Please sign in to comment.