Skip to content

Commit 9710f70

Browse files
authored
chore: remove no longer needed comments (#6517)
* chore: remove no longer needed comments - algolia/algoliasearch-helper-js#800 made the todo in numeric menu no longer needed - template is generic [FX-3215] * number
1 parent bf7e0e6 commit 9710f70

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

packages/algoliasearch-helper/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ declare namespace algoliasearchHelper {
570570
removeNumericRefinement(
571571
attribute: string,
572572
operator?: string,
573-
value?: string
573+
value?: number
574574
): SearchParameters;
575575
removeTagRefinement(tag: string): SearchParameters;
576576
resetPage(): SearchParameters;

packages/instantsearch-core/src/connectors/connectCurrentRefinements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function clearRefinementFromState(
349349
return state.removeNumericRefinement(
350350
refinement.attribute,
351351
refinement.operator,
352-
String(refinement.value)
352+
refinement.value as number
353353
);
354354
case 'tag':
355355
return state.removeTagRefinement(String(refinement.value));

packages/instantsearch-core/src/connectors/connectNumericMenu.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export type NumericMenuConnectorParamsItem = {
3434
end?: number;
3535
};
3636

37+
type NumericMenuValue = Omit<NumericMenuConnectorParamsItem, 'label'>;
38+
3739
export type NumericMenuRenderStateItem = {
3840
/**
3941
* Name of the option.
@@ -114,7 +116,6 @@ export type NumericMenuWidgetDescription = {
114116
};
115117
indexUiState: {
116118
numericMenu: {
117-
// @TODO: this could possibly become `${number}:${number}` later
118119
[attribute: string]: string;
119120
};
120121
};
@@ -169,7 +170,7 @@ export const connectNumericMenu: NumericMenuConnector =
169170
items.map(({ start, end, label }) => ({
170171
label,
171172
value: encodeURI(JSON.stringify({ start, end })),
172-
isRefined: isRefined(state, attribute, { start, end, label }),
173+
isRefined: isRefined(state, attribute, { start, end }),
173174
}));
174175

175176
const connectorState: ConnectorState = {};
@@ -346,9 +347,8 @@ export const connectNumericMenu: NumericMenuConnector =
346347
function isRefined(
347348
state: SearchParameters,
348349
attribute: string,
349-
option: NumericMenuConnectorParamsItem
350+
option: NumericMenuValue
350351
) {
351-
// @TODO: same as another spot, why is this mixing arrays & elements?
352352
const currentRefinements = state.getNumericRefinements(attribute);
353353

354354
if (option.start !== undefined && option.end !== undefined) {
@@ -385,10 +385,7 @@ function getRefinedState(
385385
facetValue: string
386386
) {
387387
let resolvedState = state;
388-
389-
const refinedOption = JSON.parse(decodeURI(facetValue));
390-
391-
// @TODO: why is array / element mixed here & hasRefinements; seems wrong?
388+
const refinedOption: NumericMenuValue = JSON.parse(decodeURI(facetValue));
392389
const currentRefinements = resolvedState.getNumericRefinements(attribute);
393390

394391
if (refinedOption.start === undefined && refinedOption.end === undefined) {

packages/instantsearch.js/src/components/Template/Template.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export type TemplateProps = {
2525
} & PreparedTemplateProps<Templates> &
2626
Readonly<typeof defaultProps>;
2727

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

0 commit comments

Comments
 (0)