instantsearch.js 4.37.2 → 4.37.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86,6 +86,9 @@ var connectBreadcrumb = function connectBreadcrumb(renderFn) {
86
86
  state = _ref2.state;
87
87
 
88
88
  function getItems() {
89
+ // The hierarchicalFacets condition is required for flavors
90
+ // that render immediately with empty results, without relying
91
+ // on init() (like React InstantSearch Hooks).
89
92
  if (!results || state.hierarchicalFacets.length === 0) {
90
93
  return [];
91
94
  }
@@ -1,5 +1,5 @@
1
1
  import { component } from "../lib/suit.js";
2
- import { getPropertyByPath, TAG_REPLACEMENT } from "../lib/utils/index.js";
2
+ import { getPropertyByPath, TAG_REPLACEMENT, warning } from "../lib/utils/index.js";
3
3
  var suit = component('Highlight');
4
4
  export default function highlight(_ref) {
5
5
  var attribute = _ref.attribute,
@@ -8,8 +8,11 @@ export default function highlight(_ref) {
8
8
  hit = _ref.hit,
9
9
  _ref$cssClasses = _ref.cssClasses,
10
10
  cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
11
+ var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); // @MAJOR fallback to attribute value if highlight is not found
11
12
 
12
- var _ref2 = getPropertyByPath(hit._highlightResult, attribute) || {},
13
+ process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, "Could not enable highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
14
+
15
+ var _ref2 = highlightAttributeResult || {},
13
16
  _ref2$value = _ref2.value,
14
17
  attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
15
18
 
@@ -1,4 +1,4 @@
1
- import { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts } from "../lib/utils/index.js";
1
+ import { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts, warning } from "../lib/utils/index.js";
2
2
  import { component } from "../lib/suit.js";
3
3
  var suit = component('ReverseHighlight');
4
4
  export default function reverseHighlight(_ref) {
@@ -8,8 +8,11 @@ export default function reverseHighlight(_ref) {
8
8
  hit = _ref.hit,
9
9
  _ref$cssClasses = _ref.cssClasses,
10
10
  cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
11
+ var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute); // @MAJOR fallback to attribute value if highlight is not found
11
12
 
12
- var _ref2 = getPropertyByPath(hit._highlightResult, attribute) || {},
13
+ process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, "Could not enable reverse highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
14
+
15
+ var _ref2 = highlightAttributeResult || {},
13
16
  _ref2$value = _ref2.value,
14
17
  attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
15
18
 
@@ -1,4 +1,4 @@
1
- import { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts } from "../lib/utils/index.js";
1
+ import { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts, warning } from "../lib/utils/index.js";
2
2
  import { component } from "../lib/suit.js";
3
3
  var suit = component('ReverseSnippet');
4
4
  export default function reverseSnippet(_ref) {
@@ -8,8 +8,11 @@ export default function reverseSnippet(_ref) {
8
8
  hit = _ref.hit,
9
9
  _ref$cssClasses = _ref.cssClasses,
10
10
  cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
11
+ var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); // @MAJOR fallback to attribute value if snippet is not found
11
12
 
12
- var _ref2 = getPropertyByPath(hit._snippetResult, attribute) || {},
13
+ process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, "Could not enable reverse snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
14
+
15
+ var _ref2 = snippetAttributeResult || {},
13
16
  _ref2$value = _ref2.value,
14
17
  attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
15
18
 
@@ -1,5 +1,5 @@
1
1
  import { component } from "../lib/suit.js";
2
- import { TAG_REPLACEMENT, getPropertyByPath } from "../lib/utils/index.js";
2
+ import { TAG_REPLACEMENT, getPropertyByPath, warning } from "../lib/utils/index.js";
3
3
  var suit = component('Snippet');
4
4
  export default function snippet(_ref) {
5
5
  var attribute = _ref.attribute,
@@ -8,8 +8,11 @@ export default function snippet(_ref) {
8
8
  hit = _ref.hit,
9
9
  _ref$cssClasses = _ref.cssClasses,
10
10
  cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
11
+ var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute); // @MAJOR fallback to attribute value if snippet is not found
11
12
 
12
- var _ref2 = getPropertyByPath(hit._snippetResult, attribute) || {},
13
+ process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, "Could not enable snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
14
+
15
+ var _ref2 = snippetAttributeResult || {},
13
16
  _ref2$value = _ref2.value,
14
17
  attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
15
18
 
@@ -1,2 +1,2 @@
1
- declare const _default: "4.37.2";
1
+ declare const _default: "4.37.3";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.37.2';
1
+ export default '4.37.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.37.2",
3
+ "version": "4.37.3",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",