react-instantsearch 6.38.3 → 6.39.1

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-instantsearch",
3
- "version": "6.38.3",
3
+ "version": "6.39.1",
4
4
  "description": "⚡ Lightning-fast search for React and React Native apps, by Algolia",
5
5
  "main": "index.js",
6
6
  "module": "dist/es/index.js",
@@ -44,13 +44,13 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.1.2",
47
- "react-instantsearch-core": "6.38.3",
48
- "react-instantsearch-dom": "6.38.3",
49
- "react-instantsearch-native": "6.38.3"
47
+ "react-instantsearch-core": "6.39.1",
48
+ "react-instantsearch-dom": "6.39.1",
49
+ "react-instantsearch-native": "6.39.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "algoliasearch": ">= 3.1 < 5",
53
53
  "react": ">= 16.3.0 < 19"
54
54
  },
55
- "gitHead": "4c473604508a865a2488e064fdd3a415f416d14a"
55
+ "gitHead": "a00311c99cae3e6f4b9f659945d46d62347bc6d8"
56
56
  }
@@ -4118,7 +4118,33 @@
4118
4118
  };
4119
4119
  });
4120
4120
  } else if (results._state.isHierarchicalFacet(attribute)) {
4121
- return find$1(results.hierarchicalFacets, predicate);
4121
+ var hierarchicalFacetValues = find$1(results.hierarchicalFacets, predicate);
4122
+ if (!hierarchicalFacetValues) return hierarchicalFacetValues;
4123
+
4124
+ var hierarchicalFacet = results._state.getHierarchicalFacetByName(attribute);
4125
+ var currentRefinementSplit = unescapeFacetValue$3(
4126
+ results._state.getHierarchicalRefinement(attribute)[0] || ''
4127
+ ).split(results._state._getHierarchicalFacetSeparator(hierarchicalFacet));
4128
+ currentRefinementSplit.unshift(attribute);
4129
+
4130
+ setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);
4131
+
4132
+ return hierarchicalFacetValues;
4133
+ }
4134
+ }
4135
+
4136
+ /**
4137
+ * Set the isRefined of a hierarchical facet result based on the current state.
4138
+ * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix
4139
+ * @param {string[]} currentRefinementSplit array of parts of the current hierarchical refinement
4140
+ * @param {number} depth recursion depth in the currentRefinement
4141
+ */
4142
+ function setIsRefined(item, currentRefinement, depth) {
4143
+ item.isRefined = item.name === currentRefinement[depth];
4144
+ if (item.data) {
4145
+ item.data.forEach(function(child) {
4146
+ setIsRefined(child, currentRefinement, depth + 1);
4147
+ });
4122
4148
  }
4123
4149
  }
4124
4150
 
@@ -5207,7 +5233,7 @@
5207
5233
 
5208
5234
  var requestBuilder_1 = requestBuilder;
5209
5235
 
5210
- var version = '3.11.2';
5236
+ var version = '3.11.3';
5211
5237
 
5212
5238
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
5213
5239