Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: algolia/instantsearch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.27.2
Choose a base ref
...
head repository: algolia/instantsearch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.28.0
Choose a head ref
  • 6 commits
  • 61 files changed
  • 2 contributors

Commits on Aug 19, 2021

  1. fix(svg): remove xmlns (#4839)

    xml namespace is not required for svg elements (and has never been https://stackoverflow.com/a/18468348/3185307), only for svg documents.
    
    This saves a probably insignificant amount of bundlesize
    Haroenv authored Aug 19, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    932ae3a View commit details

Commits on Aug 20, 2021

  1. refactor(sendEventForHits): remove __escaped more efficiently (#4840)

    * refactor(sendEventForHits): remove __escaped more efficiently
    
    Mapping over the hits isn't heavy, but it's not required, as .slice also removes the __escaped key on hits
    
    * whooops forgot to install
    Haroenv authored Aug 20, 2021
    Copy the full SHA
    2332c21 View commit details
  2. test(eslint): enable no-unnecessary-type-assertion (#4842)

    * test(eslint): enable no-unnecessary-type-assertion
    
    There's a lot of assertions in our code base that were once necessary, but that's no longer the case.
    
    This rule requires typescript, so files that are ignored in typescript also need to be ignored for these rules
    
    * these things are meant to be errors
    Haroenv authored Aug 20, 2021
    Copy the full SHA
    047acd0 View commit details

Commits on Aug 24, 2021

  1. fix(sendEvent): split > 20 objects in multiple calls (#4841)

    * fix(sendEvent): split > 20 objects in multiple calls
    
    DX-2379
    
    * bindEvent allows multiple now too
    Haroenv authored Aug 24, 2021
    Copy the full SHA
    44574bc View commit details
  2. feat(ts): expose built files in umd (#4844)

    * feat(ts): expose built files in umd
    
    This can be achieved using the dtsRollup feature of api-extractor, which isn't needed for the es build, as local files work perfectly fine in that case.
    
    Make sure to check the generated files when reviewing this PR
    
    * change sandbox to allow debugging all types
    Haroenv authored Aug 24, 2021
    Copy the full SHA
    8578ae3 View commit details
  3. Copy the full SHA
    f5bc9d2 View commit details
Showing with 869 additions and 626 deletions.
  1. +1 −1 .codesandbox/ci.json
  2. +19 −0 .eslintrc.js
  3. +15 −0 CHANGELOG.md
  4. +1 −1 package.json
  5. +2 −1 scripts/typescript/api-extractor.json
  6. +21 −6 scripts/typescript/extract.js
  7. +4 −3 src/components/Panel/Panel.tsx
  8. +1 −1 src/components/Slider/Rheostat.tsx
  9. +1 −1 src/connectors/answers/connectAnswers.ts
  10. +8 −8 src/connectors/autocomplete/__tests__/connectAutocomplete-test.ts
  11. +2 −2 src/connectors/autocomplete/connectAutocomplete.ts
  12. +19 −19 src/connectors/configure/__tests__/connectConfigure-test.ts
  13. +1 −1 src/connectors/dynamic-widgets/connectDynamicWidgets.ts
  14. +1 −1 src/connectors/geo-search/__tests__/connectGeoSearch-test.ts
  15. +40 −43 src/connectors/hierarchical-menu/__tests__/connectHierarchicalMenu-test.ts
  16. +1 −1 src/connectors/hierarchical-menu/connectHierarchicalMenu.ts
  17. +9 −9 src/connectors/hits-per-page/__tests__/connectHitsPerPage-test.ts
  18. +41 −37 src/connectors/hits/__tests__/connectHits-test.ts
  19. +2 −2 src/connectors/hits/connectHits.ts
  20. +53 −49 src/connectors/infinite-hits/__tests__/connectInfiniteHits-test.ts
  21. +2 −2 src/connectors/infinite-hits/connectInfiniteHits.ts
  22. +35 −35 src/connectors/menu/__tests__/connectMenu-test.ts
  23. +1 −1 src/connectors/menu/connectMenu.ts
  24. +15 −15 src/connectors/numeric-menu/__tests__/connectNumericMenu-test.ts
  25. +5 −9 src/connectors/numeric-menu/connectNumericMenu.ts
  26. +5 −5 src/connectors/pagination/__tests__/connectPagination-test.ts
  27. +23 −55 src/connectors/query-rules/__tests__/connectQueryRules-test.ts
  28. +63 −63 src/connectors/range/__tests__/connectRange-test.ts
  29. +9 −9 src/connectors/rating-menu/__tests__/connectRatingMenu-test.ts
  30. +3 −3 src/connectors/rating-menu/connectRatingMenu.ts
  31. +52 −52 src/connectors/refinement-list/__tests__/connectRefinementList-test.ts
  32. +1 −1 src/connectors/refinement-list/connectRefinementList.ts
  33. +9 −9 src/connectors/relevant-sort/__tests__/connectRelevantSort-test.ts
  34. +2 −2 src/connectors/search-box/__tests__/connectSearchBox-test.ts
  35. +4 −4 src/connectors/sort-by/__tests__/connectSortBy-test.ts
  36. +2 −2 src/helpers/insights.ts
  37. +4 −5 src/lib/insights/listener.tsx
  38. +247 −45 src/lib/utils/__tests__/createSendEventForHits-test.ts
  39. +1 −1 src/lib/utils/checkIndexUiState.ts
  40. +81 −60 src/lib/utils/createSendEventForHits.ts
  41. +2 −2 src/lib/utils/mergeSearchParameters.ts
  42. +3 −3 src/lib/utils/serializer.ts
  43. +1 −1 src/lib/version.ts
  44. +1 −1 src/widgets/__tests__/index.test.ts
  45. +11 −11 src/widgets/dynamic-widgets/__tests__/dynamic-widgets-test.ts
  46. +1 −1 src/widgets/hits-per-page/__tests__/hits-per-page-test.ts
  47. +4 −2 src/widgets/index/__tests__/index-test.ts
  48. +2 −2 src/widgets/index/index.ts
  49. +1 −1 src/widgets/menu-select/__tests__/menu-select-test.ts
  50. +2 −2 src/widgets/menu/__tests__/menu-test.ts
  51. +1 −1 src/widgets/numeric-menu/__tests__/numeric-menu-test.ts
  52. +12 −12 src/widgets/places/__tests__/places-test.ts
  53. +1 −1 src/widgets/query-rule-custom-data/query-rule-custom-data.tsx
  54. +1 −1 src/widgets/rating-menu/__tests__/rating-menu-integration-test.ts
  55. +3 −3 src/widgets/rating-menu/__tests__/rating-menu-test.ts
  56. +1 −1 src/widgets/rating-menu/rating-menu.tsx
  57. +3 −3 src/widgets/refinement-list/__tests__/__snapshots__/refinement-list-test.ts.snap
  58. +9 −9 src/widgets/search-box/__tests__/__snapshots__/search-box-test.ts.snap
  59. +3 −3 src/widgets/search-box/defaultTemplates.ts
  60. +0 −1 src/widgets/voice-search/defaultTemplates.ts
  61. +1 −1 stories/query-rule-custom-data.stories.ts
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"sandboxes": ["instantsearchjs-es-template-pcw1k"],
"buildCommand": "build:es"
"buildCommand": "build"
}
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -62,6 +62,25 @@ module.exports = {
'@typescript-eslint/no-redeclare': ['error'],
},
},
{
files: ['*.ts', '*.tsx'],
// this is the same files as ignored in tsconfig.json
excludedFiles: [
"examples/**/*",
"es",
// these two files are temporarily excluded because
// they import files from node_modules/search-insights directly
// and it causes the type-checking to fail.
"src/middlewares/__tests__/createInsightsMiddleware.ts",
"test/mock/createInsightsClient.ts"
],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
},
},
{
files: ['*.js'],
rules: {
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [4.28.0](https://github.com/algolia/instantsearch.js/compare/v4.27.2...v4.28.0) (2021-08-24)


### Bug Fixes

* **sendEvent:** split > 20 objects in multiple calls ([#4841](https://github.com/algolia/instantsearch.js/issues/4841)) ([44574bc](https://github.com/algolia/instantsearch.js/commit/44574bcf03ac05e22274099622e6a1839599ca7e))
* **svg:** remove xmlns ([#4839](https://github.com/algolia/instantsearch.js/issues/4839)) ([932ae3a](https://github.com/algolia/instantsearch.js/commit/932ae3a868340a32ccaacb276c862921fee41a93))


### Features

* **ts:** expose built files in umd ([#4844](https://github.com/algolia/instantsearch.js/issues/4844)) ([8578ae3](https://github.com/algolia/instantsearch.js/commit/8578ae30a915db49acaa0292faba2ec6ccd52b73))



## [4.27.2](https://github.com/algolia/instantsearch.js/compare/v4.27.1...v4.27.2) (2021-08-18)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instantsearch.js",
"version": "4.27.2",
"version": "4.28.0",
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
"types": "es/index.d.ts",
3 changes: 2 additions & 1 deletion scripts/typescript/api-extractor.json
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@
"mainEntryPointFilePath": "<projectFolder>/es/index.d.ts",

"dtsRollup": {
"enabled": false
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/instantsearch.production.d.ts"
},

"apiReport": {
27 changes: 21 additions & 6 deletions scripts/typescript/extract.js
Original file line number Diff line number Diff line change
@@ -19,12 +19,6 @@ shell.sed(
path.join(__dirname, '../../es/**/*.d.ts')
);

// expose only the es entry point, not the umd entry point
shell.mv(
path.join(__dirname, '../../es/index.es.d.ts'),
path.join(__dirname, '../../es/index.d.ts')
);

console.log();
console.log(`Validating definitions...`);

@@ -47,3 +41,24 @@ if (!result.succeeded) {

process.exitCode = 1;
}

// move the right entry points
// esm to override umd
shell.mv(
path.join(__dirname, '../../es/index.es.d.ts'),
path.join(__dirname, '../../es/index.d.ts')
);

// production and development umd
shell.cp(
path.join(__dirname, '../../dist/instantsearch.production.d.ts'),
path.join(__dirname, '../../dist/instantsearch.production.min.d.ts')
);
shell.cp(
path.join(__dirname, '../../dist/instantsearch.production.d.ts'),
path.join(__dirname, '../../dist/instantsearch.development.d.ts')
);
shell.cp(
path.join(__dirname, '../../dist/instantsearch.production.d.ts'),
path.join(__dirname, '../../dist/instantsearch.development.min.d.ts')
);
7 changes: 4 additions & 3 deletions src/components/Panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -40,14 +40,15 @@ function Panel<TWidget extends UnknownWidgetFactory>(
const bodyRef = useRef<HTMLElement | null>(null);

useEffect(() => {
if (!bodyRef.current) {
const node = bodyRef.current;
if (!node) {
return undefined;
}

bodyRef.current.appendChild(props.bodyElement);
node.appendChild(props.bodyElement);

return () => {
bodyRef!.current!.removeChild(props.bodyElement);
node.removeChild(props.bodyElement);
};
}, [bodyRef, props.bodyElement]);

2 changes: 1 addition & 1 deletion src/components/Slider/Rheostat.tsx
Original file line number Diff line number Diff line change
@@ -303,7 +303,7 @@ class Rheostat extends Component<Props, State> {
if (!this.props.snapPoints!.length) return value;

return this.props.snapPoints!.reduce((snapTo, snap) =>
Math.abs(snapTo! - value) < Math.abs(snap - value) ? snapTo : snap
Math.abs(snapTo - value) < Math.abs(snap - value) ? snapTo : snap
);
}

2 changes: 1 addition & 1 deletion src/connectors/answers/connectAnswers.ts
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ const connectAnswers: AnswersConnector = function connectAnswers(

init(initOptions) {
const { state, instantSearchInstance } = initOptions;
const answersIndex = instantSearchInstance.client!.initIndex!(
const answersIndex = instantSearchInstance.client.initIndex!(
state.index
);
if (!hasFindAnswersMethod(answersIndex)) {
Original file line number Diff line number Diff line change
@@ -556,7 +556,7 @@ search.addWidgets([
test('should give back the object unmodified if the default value is selected', () => {
const [widget, helper] = getInitializedWidget();
const uiStateBefore = {};
const uiStateAfter = widget.getWidgetUiState!(uiStateBefore, {
const uiStateAfter = widget.getWidgetUiState(uiStateBefore, {
searchParameters: helper.state,
helper,
});
@@ -567,7 +567,7 @@ search.addWidgets([
const [widget, helper, refine] = getInitializedWidget();
refine('some query');
const uiStateBefore = {};
const uiStateAfter = widget.getWidgetUiState!(uiStateBefore, {
const uiStateAfter = widget.getWidgetUiState(uiStateBefore, {
searchParameters: helper.state,
helper,
});
@@ -579,14 +579,14 @@ search.addWidgets([
test('should give back the same instance if the value is already in the uiState', () => {
const [widget, helper, refine] = getInitializedWidget();
refine('query');
const uiStateBefore = widget.getWidgetUiState!(
const uiStateBefore = widget.getWidgetUiState(
{},
{
searchParameters: helper.state,
helper,
}
);
const uiStateAfter = widget.getWidgetUiState!(uiStateBefore, {
const uiStateAfter = widget.getWidgetUiState(uiStateBefore, {
searchParameters: helper.state,
helper,
});
@@ -604,7 +604,7 @@ search.addWidgets([
})
);

const actual = widget.getWidgetSearchParameters!(helper.state, {
const actual = widget.getWidgetSearchParameters(helper.state, {
uiState: {
query: 'Apple',
},
@@ -628,7 +628,7 @@ search.addWidgets([
})
);

const actual = widget.getWidgetSearchParameters!(helper.state, {
const actual = widget.getWidgetSearchParameters(helper.state, {
uiState: {},
});

@@ -652,7 +652,7 @@ search.addWidgets([
})
);

const actual = widget.getWidgetSearchParameters!(helper.state, {
const actual = widget.getWidgetSearchParameters(helper.state, {
uiState: {},
});

@@ -676,7 +676,7 @@ search.addWidgets([
})
);

const actual = widget.getWidgetSearchParameters!(helper.state, {
const actual = widget.getWidgetSearchParameters(helper.state, {
uiState: {},
});

4 changes: 2 additions & 2 deletions src/connectors/autocomplete/connectAutocomplete.ts
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ search.addWidgets([
const sendEvent = createSendEventForHits({
instantSearchInstance,
index: scopedResult.results.index,
widgetType: this.$$type!,
widgetType: this.$$type,
});

return {
@@ -191,7 +191,7 @@ search.addWidgets([
return {
currentRefinement: helper.state.query || '',
indices,
refine: connectorState.refine!,
refine: connectorState.refine,
widgetParams,
};
},
Loading