Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-instantsearch-core

Package Overview
Dependencies
Maintainers
6
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-instantsearch-core - npm Package Compare versions

Comparing version 6.17.0 to 6.18.0

38

dist/cjs/connectors/connectDynamicWidgets.js

@@ -16,2 +16,4 @@ "use strict";

var MAX_WILDCARD_FACETS = 20;
var _default = (0, _createConnector.default)({

@@ -22,6 +24,9 @@ displayName: 'AlgoliaDynamicWidgets',

return items;
}
},
maxValuesPerFacet: 20
},
propTypes: {
transformItems: _propTypes.default.func
transformItems: _propTypes.default.func,
facets: _propTypes.default.arrayOf(_propTypes.default.string),
maxValuesPerFacet: _propTypes.default.number
},

@@ -34,2 +39,6 @@ getProvidedProps: function getProvidedProps(props, _searchState, searchResults) {

if (props.facets && !(Array.isArray(props.facets) && props.facets.length <= 1 && (props.facets[0] === '*' || props.facets[0] === undefined))) {
throw new Error("The `facets` prop only accepts [] or [\"*\"], you passed ".concat(JSON.stringify(props.facets)));
}
if (!results) {

@@ -42,7 +51,26 @@ return {

var facetOrder = results.renderingContent && results.renderingContent.facetOrdering && results.renderingContent.facetOrdering.facets && results.renderingContent.facetOrdering.facets.order || [];
var attributesToRender = props.transformItems(facetOrder, {
results: results
});
if (attributesToRender.length > MAX_WILDCARD_FACETS && !props.facets) {
// eslint-disable-next-line no-console
console.warn("More than ".concat(MAX_WILDCARD_FACETS, " facets are requested to be displayed without explicitly setting which facets to retrieve. This could have a performance impact. Set \"facets\" to [] to do two smaller network requests, or explicitly to ['*'] to avoid this warning."));
}
if (props.maxValuesPerFacet < results._state.maxValuesPerFacet) {
// eslint-disable-next-line no-console
console.warn("The maxValuesPerFacet set by dynamic widgets (".concat(props.maxValuesPerFacet, ") is smaller than one of the limits set by a widget (").concat(results._state.maxValuesPerFacet, "). This causes a mismatch in query parameters and thus an extra network request when that widget is mounted."));
}
return {
attributesToRender: props.transformItems(facetOrder, {
results: results
})
attributesToRender: attributesToRender
};
},
getSearchParameters: function getSearchParameters(searchParameters, props) {
return (props.facets || ['*']).reduce(function (acc, curr) {
return acc.addFacet(curr);
}, searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(props.maxValuesPerFacet || 0, searchParameters.maxValuesPerFacet || 0)
}));
}

@@ -49,0 +77,0 @@ });

@@ -43,2 +43,3 @@ "use strict";

if (prop) {
// eslint-disable-next-line no-restricted-syntax
for (var _i = 0, _Object$keys = Object.keys(prop); _i < _Object$keys.length; _i++) {

@@ -45,0 +46,0 @@ var key = _Object$keys[_i];

2

dist/cjs/core/version.js

@@ -7,3 +7,3 @@ "use strict";

exports.default = void 0;
var _default = '6.17.0';
var _default = '6.18.0';
exports.default = _default;
import PropTypes from 'prop-types';
import createConnector from '../core/createConnector';
import { getResults } from '../core/indexUtils';
var MAX_WILDCARD_FACETS = 20;
export default createConnector({

@@ -9,6 +10,9 @@ displayName: 'AlgoliaDynamicWidgets',

return items;
}
},
maxValuesPerFacet: 20
},
propTypes: {
transformItems: PropTypes.func
transformItems: PropTypes.func,
facets: PropTypes.arrayOf(PropTypes.string),
maxValuesPerFacet: PropTypes.number
},

@@ -21,2 +25,6 @@ getProvidedProps: function getProvidedProps(props, _searchState, searchResults) {

if (props.facets && !(Array.isArray(props.facets) && props.facets.length <= 1 && (props.facets[0] === '*' || props.facets[0] === undefined))) {
throw new Error("The `facets` prop only accepts [] or [\"*\"], you passed ".concat(JSON.stringify(props.facets)));
}
if (!results) {

@@ -29,8 +37,27 @@ return {

var facetOrder = results.renderingContent && results.renderingContent.facetOrdering && results.renderingContent.facetOrdering.facets && results.renderingContent.facetOrdering.facets.order || [];
var attributesToRender = props.transformItems(facetOrder, {
results: results
});
if (attributesToRender.length > MAX_WILDCARD_FACETS && !props.facets) {
// eslint-disable-next-line no-console
console.warn("More than ".concat(MAX_WILDCARD_FACETS, " facets are requested to be displayed without explicitly setting which facets to retrieve. This could have a performance impact. Set \"facets\" to [] to do two smaller network requests, or explicitly to ['*'] to avoid this warning."));
}
if (props.maxValuesPerFacet < results._state.maxValuesPerFacet) {
// eslint-disable-next-line no-console
console.warn("The maxValuesPerFacet set by dynamic widgets (".concat(props.maxValuesPerFacet, ") is smaller than one of the limits set by a widget (").concat(results._state.maxValuesPerFacet, "). This causes a mismatch in query parameters and thus an extra network request when that widget is mounted."));
}
return {
attributesToRender: props.transformItems(facetOrder, {
results: results
})
attributesToRender: attributesToRender
};
},
getSearchParameters: function getSearchParameters(searchParameters, props) {
return (props.facets || ['*']).reduce(function (acc, curr) {
return acc.addFacet(curr);
}, searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(props.maxValuesPerFacet || 0, searchParameters.maxValuesPerFacet || 0)
}));
}
});

@@ -21,2 +21,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

if (prop) {
// eslint-disable-next-line no-restricted-syntax
for (var _i = 0, _Object$keys = Object.keys(prop); _i < _Object$keys.length; _i++) {

@@ -23,0 +24,0 @@ var key = _Object$keys[_i];

@@ -1,1 +0,1 @@

export default '6.17.0';
export default '6.18.0';
{
"name": "react-instantsearch-core",
"version": "6.17.0",
"version": "6.18.0",
"description": "⚡ Lightning-fast search for React, by Algolia",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc