@fluid-topics/ft-search-context 2.0.1 → 2.0.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/build/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./ft-search-context.properties";
3
3
  export * from "./ft-search-context";
4
4
  export * from "./store/FtSearchStateManager";
5
5
  export * from "./store/utils/analytics-utils";
6
+ import "./define";
package/build/index.js CHANGED
@@ -3,3 +3,4 @@ export * from "./ft-search-context.properties";
3
3
  export * from "./ft-search-context";
4
4
  export * from "./store/FtSearchStateManager";
5
5
  export * from "./store/utils/analytics-utils";
6
+ import "./define";
@@ -271,7 +271,7 @@ export class FtSearchStateManager extends FtStateManager {
271
271
  return this.localesDebouncer.run(async () => this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales));
272
272
  }
273
273
  async fetchSearchData(request) {
274
- var _a, _b, _c, _d;
274
+ var _a, _b, _c, _d, _e;
275
275
  (_a = this.cancelableSearch) === null || _a === void 0 ? void 0 : _a.cancel();
276
276
  if (!this.isRequestNeeded(FtSearchStateResourceRequest.CLUSTERED_SEARCH)) {
277
277
  return;
@@ -285,6 +285,13 @@ export class FtSearchStateManager extends FtStateManager {
285
285
  this.store.actions.spellcheck(undefined);
286
286
  }
287
287
  else {
288
+ if (!((_b = this.store.getState().results) === null || _b === void 0 ? void 0 : _b.length)) {
289
+ // Fix for AMS-5536
290
+ // Event was not sent when doing two searches with no results in a row.
291
+ // This is due to the results not being changed so the watch() on it is not called and the event is not sent.
292
+ // By setting the results to undefined before doing the search, we unsure the results will be changed everytime a search is done.
293
+ this.store.actions.results(undefined);
294
+ }
288
295
  this.cancelableSearch = cancelable(this.service.launchSearch(request));
289
296
  const results = await this.cancelableSearch;
290
297
  this.store.actions.announcements(results.announcements);
@@ -294,11 +301,11 @@ export class FtSearchStateManager extends FtStateManager {
294
301
  this.store.actions.spellcheck(results.spellcheck);
295
302
  }
296
303
  else {
297
- const newResults = ((_b = this.store.getState().results) !== null && _b !== void 0 ? _b : []).concat(results.results);
304
+ const newResults = ((_c = this.store.getState().results) !== null && _c !== void 0 ? _c : []).concat(results.results);
298
305
  this.store.actions.results(newResults);
299
306
  // Focus on first new result
300
307
  this.store.commands.clear(/^focus-result-/);
301
- this.store.commands.add({ type: `focus-result-${(results.paging.currentPage - 1) * ((_c = request.paging.perPage) !== null && _c !== void 0 ? _c : 20) + 1}` });
308
+ this.store.commands.add({ type: `focus-result-${(results.paging.currentPage - 1) * ((_d = request.paging.perPage) !== null && _d !== void 0 ? _d : 20) + 1}` });
302
309
  }
303
310
  this.store.actions.paging(results.paging);
304
311
  }
@@ -306,7 +313,7 @@ export class FtSearchStateManager extends FtStateManager {
306
313
  catch (e) {
307
314
  if (!(e instanceof CanceledPromiseError)) {
308
315
  console.error(e);
309
- (_d = this.errorHandler) === null || _d === void 0 ? void 0 : _d.call(this, e);
316
+ (_e = this.errorHandler) === null || _e === void 0 ? void 0 : _e.call(this, e);
310
317
  }
311
318
  }
312
319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-context",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Context block for integrated search components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,12 +19,12 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "2.0.1",
23
- "@fluid-topics/ft-wc-utils": "2.0.1",
22
+ "@fluid-topics/ft-app-context": "2.0.3",
23
+ "@fluid-topics/ft-wc-utils": "2.0.3",
24
24
  "lit": "3.1.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@fluid-topics/public-api": "1.0.114"
28
28
  },
29
- "gitHead": "26bf1bd750f8272124b045d597e18b1eff63c518"
29
+ "gitHead": "0f2fb13480a71c2957ef7c69492140ea685ba87e"
30
30
  }