Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connectQueryRules): improve tracked refinement type #3648

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/connectors/query-rules/connectQueryRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import {
NumericRefinement as InternalNumericRefinement,
} from '../../lib/utils/getRefinements';

type TrackedFilterRefinement = string | number | boolean;

export type ParamTrackedFilters = {
[facetName: string]: (
facetValues: Array<string | number>
) => Array<string | number>;
facetValues: TrackedFilterRefinement[]
francoischalifour marked this conversation as resolved.
Show resolved Hide resolved
) => TrackedFilterRefinement[];
};
export type ParamTransformRuleContexts = (ruleContexts: string[]) => string[];
type ParamTransformItems = (items: object[]) => any;
Expand Down Expand Up @@ -85,7 +87,7 @@ function getRuleContextsFromTrackedFilters({
}) {
const ruleContexts = Object.keys(trackedFilters).reduce<string[]>(
(facets, facetName) => {
const facetRefinements: Array<string | number> = getRefinements(
const facetRefinements: TrackedFilterRefinement[] = getRefinements(
helper.lastResults || {},
sharedHelperState
)
Expand Down