instantsearch.js 4.56.1 → 4.56.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.
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +4 -2
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createInsightsMiddleware.js +18 -8
- package/dist/instantsearch.development.js +29 -14
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/infinite-hits/connectInfiniteHits.js +4 -2
- package/es/lib/utils/render-args.d.ts +2 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.js +18 -8
- package/package.json +6 -6
|
@@ -165,7 +165,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
165
165
|
});
|
|
166
166
|
isFirstPage = state.page === undefined || getFirstReceivedPage(state, cachedHits) === 0;
|
|
167
167
|
} else {
|
|
168
|
-
var
|
|
168
|
+
var _state$disjunctiveFac, _state$hierarchicalFa;
|
|
169
169
|
var _state$page3 = state.page,
|
|
170
170
|
_page = _state$page3 === void 0 ? 0 : _state$page3;
|
|
171
171
|
if (escapeHTML && results.hits.length > 0) {
|
|
@@ -189,7 +189,9 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
189
189
|
hasDynamicWidgets = true;
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
-
var hasNoFacets = !((
|
|
192
|
+
var hasNoFacets = !((_state$disjunctiveFac = state.disjunctiveFacets) !== null && _state$disjunctiveFac !== void 0 && _state$disjunctiveFac.length) && !(state.facets || []).filter(function (f) {
|
|
193
|
+
return f !== '*';
|
|
194
|
+
}).length && !((_state$hierarchicalFa = state.hierarchicalFacets) !== null && _state$hierarchicalFa !== void 0 && _state$hierarchicalFa.length);
|
|
193
195
|
if (cachedHits[_page] === undefined && !results.__isArtificial && instantSearchInstance.status === 'idle' && !(hasDynamicWidgets && hasNoFacets)) {
|
|
194
196
|
cachedHits[_page] = transformedHits;
|
|
195
197
|
cache.write({
|
|
@@ -3,7 +3,7 @@ import type { IndexWidget } from '../../widgets/index/index';
|
|
|
3
3
|
export declare function createInitArgs(instantSearchInstance: InstantSearch, parent: IndexWidget, uiState: UiState): {
|
|
4
4
|
uiState: UiState;
|
|
5
5
|
helper: import("algoliasearch-helper").AlgoliaSearchHelper;
|
|
6
|
-
parent: IndexWidget
|
|
6
|
+
parent: IndexWidget;
|
|
7
7
|
instantSearchInstance: InstantSearch<UiState, UiState>;
|
|
8
8
|
state: import("algoliasearch-helper").SearchParameters;
|
|
9
9
|
renderState: import("../../types").RenderState;
|
|
@@ -18,7 +18,7 @@ export declare function createInitArgs(instantSearchInstance: InstantSearch, par
|
|
|
18
18
|
};
|
|
19
19
|
export declare function createRenderArgs(instantSearchInstance: InstantSearch, parent: IndexWidget): {
|
|
20
20
|
helper: import("algoliasearch-helper").AlgoliaSearchHelper;
|
|
21
|
-
parent: IndexWidget
|
|
21
|
+
parent: IndexWidget;
|
|
22
22
|
instantSearchInstance: InstantSearch<UiState, UiState>;
|
|
23
23
|
results: import("algoliasearch-helper").SearchResults<any>;
|
|
24
24
|
scopedResults: import("../../types").ScopedResult[];
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.56.
|
|
1
|
+
declare const _default: "4.56.3";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.56.
|
|
1
|
+
export default '4.56.3';
|
|
@@ -147,31 +147,41 @@ export function createInsightsMiddleware() {
|
|
|
147
147
|
instantSearchInstance.scheduleSearch();
|
|
148
148
|
}
|
|
149
149
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
150
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
150
151
|
if (!userToken) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
154
|
var existingToken = helper.state.userToken;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
function applyToken() {
|
|
156
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
157
|
+
userToken: userToken
|
|
158
|
+
}));
|
|
159
|
+
if (existingToken && existingToken !== userToken) {
|
|
160
|
+
instantSearchInstance.scheduleSearch();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Delay the token application to the next render cycle
|
|
165
|
+
if (!immediate) {
|
|
166
|
+
setTimeout(applyToken, 0);
|
|
167
|
+
} else {
|
|
168
|
+
applyToken();
|
|
159
169
|
}
|
|
160
170
|
};
|
|
161
171
|
var anonymousUserToken = getInsightsAnonymousUserTokenInternal();
|
|
162
172
|
if (anonymousUserToken) {
|
|
163
173
|
// When `aa('init', { ... })` is called, it creates an anonymous user token in cookie.
|
|
164
174
|
// We can set it as userToken.
|
|
165
|
-
setUserTokenToSearch(anonymousUserToken);
|
|
175
|
+
setUserTokenToSearch(anonymousUserToken, true);
|
|
166
176
|
}
|
|
167
177
|
|
|
168
178
|
// We consider the `userToken` coming from a `init` call to have a higher
|
|
169
179
|
// importance than the one coming from the queue.
|
|
170
180
|
if (userTokenBeforeInit) {
|
|
171
|
-
setUserTokenToSearch(userTokenBeforeInit);
|
|
181
|
+
setUserTokenToSearch(userTokenBeforeInit, true);
|
|
172
182
|
insightsClient('setUserToken', userTokenBeforeInit);
|
|
173
183
|
} else if (queuedUserToken) {
|
|
174
|
-
setUserTokenToSearch(queuedUserToken);
|
|
184
|
+
setUserTokenToSearch(queuedUserToken, true);
|
|
175
185
|
insightsClient('setUserToken', queuedUserToken);
|
|
176
186
|
}
|
|
177
187
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.56.
|
|
3
|
+
"version": "4.56.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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/google.maps": "^3.45.3",
|
|
34
34
|
"@types/hogan.js": "^3.0.0",
|
|
35
35
|
"@types/qs": "^6.5.3",
|
|
36
|
-
"algoliasearch-helper": "^3.13.
|
|
36
|
+
"algoliasearch-helper": "^3.13.2",
|
|
37
37
|
"hogan.js": "^3.0.2",
|
|
38
38
|
"htm": "^3.0.0",
|
|
39
39
|
"preact": "^10.10.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"version": "./scripts/version/update-version.js"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@instantsearch/mocks": "1.
|
|
59
|
-
"@instantsearch/tests": "1.
|
|
60
|
-
"@instantsearch/testutils": "1.
|
|
58
|
+
"@instantsearch/mocks": "1.16.0",
|
|
59
|
+
"@instantsearch/tests": "1.16.0",
|
|
60
|
+
"@instantsearch/testutils": "1.5.0",
|
|
61
61
|
"@storybook/html": "5.3.9",
|
|
62
62
|
"@types/scriptjs": "0.0.2",
|
|
63
63
|
"algoliasearch": "4.14.3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"scriptjs": "2.5.9",
|
|
66
66
|
"webpack": "4.41.5"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f550379829306217e021fd9c538ec4ebd0153b19"
|
|
69
69
|
}
|