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

chore: remove no longer needed comments #6517

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/algoliasearch-helper/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ declare namespace algoliasearchHelper {
removeNumericRefinement(
attribute: string,
operator?: string,
value?: string
value?: number
): SearchParameters;
removeTagRefinement(tag: string): SearchParameters;
resetPage(): SearchParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function clearRefinementFromState(
return state.removeNumericRefinement(
refinement.attribute,
refinement.operator,
String(refinement.value)
refinement.value as number
);
case 'tag':
return state.removeTagRefinement(String(refinement.value));
Expand Down
13 changes: 5 additions & 8 deletions packages/instantsearch-core/src/connectors/connectNumericMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export type NumericMenuConnectorParamsItem = {
end?: number;
};

type NumericMenuValue = Omit<NumericMenuConnectorParamsItem, 'label'>;

export type NumericMenuRenderStateItem = {
/**
* Name of the option.
Expand Down Expand Up @@ -114,7 +116,6 @@ export type NumericMenuWidgetDescription = {
};
indexUiState: {
numericMenu: {
// @TODO: this could possibly become `${number}:${number}` later
[attribute: string]: string;
};
};
Expand Down Expand Up @@ -169,7 +170,7 @@ export const connectNumericMenu: NumericMenuConnector =
items.map(({ start, end, label }) => ({
label,
value: encodeURI(JSON.stringify({ start, end })),
isRefined: isRefined(state, attribute, { start, end, label }),
isRefined: isRefined(state, attribute, { start, end }),
}));

const connectorState: ConnectorState = {};
Expand Down Expand Up @@ -347,9 +348,8 @@ export const connectNumericMenu: NumericMenuConnector =
function isRefined(
state: SearchParameters,
attribute: string,
option: NumericMenuConnectorParamsItem
option: NumericMenuValue
) {
// @TODO: same as another spot, why is this mixing arrays & elements?
const currentRefinements = state.getNumericRefinements(attribute);

if (option.start !== undefined && option.end !== undefined) {
Expand Down Expand Up @@ -386,10 +386,7 @@ function getRefinedState(
facetValue: string
) {
let resolvedState = state;

const refinedOption = JSON.parse(decodeURI(facetValue));

// @TODO: why is array / element mixed here & hasRefinements; seems wrong?
const refinedOption: NumericMenuValue = JSON.parse(decodeURI(facetValue));
const currentRefinements = resolvedState.getNumericRefinements(attribute);

if (refinedOption.start === undefined && refinedOption.end === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export type TemplateProps = {
} & PreparedTemplateProps<Templates> &
Readonly<typeof defaultProps>;

// @TODO: Template should be a generic and receive TData to pass to Templates (to avoid TTemplateData to be set as `any`)
class Template extends Component<TemplateProps> {
public static readonly defaultProps = defaultProps;

Expand Down