@salesforcedevs/dx-components 0.10.1-alpha.134 → 0.10.1-alpha.138

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.10.1-alpha.134",
3
+ "version": "0.10.1-alpha.138",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -37,18 +37,22 @@ export default class SidebarSearch extends LightningElement {
37
37
  return this._coveoAdvancedQueryConfig;
38
38
  }
39
39
  set coveoAdvancedQueryConfig(value: string) {
40
- this._coveoAdvancedQueryConfig = toJson(value);
40
+ const jsonValue = toJson(value);
41
+ const hasChanged =
42
+ this._coveoAdvancedQueryConfig &&
43
+ Object.entries(jsonValue).every(
44
+ ([key, val]: [string, any]) =>
45
+ this._coveoAdvancedQueryConfig[key] === val
46
+ );
47
+ console.log({ hasChanged }, this._coveoAdvancedQueryConfig, value);
48
+ this._coveoAdvancedQueryConfig = jsonValue;
41
49
 
42
- if (
43
- this._coveoAdvancedQueryConfigValue &&
44
- value !== this._coveoAdvancedQueryConfigValue &&
45
- this.engine
46
- ) {
50
+ if (hasChanged && this.engine) {
47
51
  // set adnvanced filters needs access to the latest coveoAdvancedQueryConfig
52
+ this.dispatchOnLoading(true);
48
53
  this.setAdvancedFilters(this.engine);
54
+ this.submitSearch();
49
55
  }
50
-
51
- this._coveoAdvancedQueryConfigValue = value;
52
56
  }
53
57
 
54
58
  @api
@@ -64,7 +68,6 @@ export default class SidebarSearch extends LightningElement {
64
68
  this.value = searchTerm || "";
65
69
  }
66
70
 
67
- private _coveoAdvancedQueryConfigValue!: string;
68
71
  private _coveoAdvancedQueryConfig!: { [key: string]: any };
69
72
  private dropdownRequestedOpen: boolean = false;
70
73
  private recentSearches: Option[] = [];
@@ -253,7 +256,7 @@ export default class SidebarSearch extends LightningElement {
253
256
  };
254
257
 
255
258
  private setAdvancedFilters(engine: SearchEngine) {
256
- console.log('setting advanced filters')
259
+ console.log("setting advanced filters");
257
260
  const aq = Object.entries(this.coveoAdvancedQueryConfig).reduce(
258
261
  (result, [key, value]) =>
259
262
  `${result}(@${key}=="${normalizeCoveoAdvancedQueryValue(
@@ -364,6 +367,7 @@ export default class SidebarSearch extends LightningElement {
364
367
 
365
368
  private onClickRecentSearch(e: CustomEvent) {
366
369
  this.value = e.detail;
370
+ this.dispatchSidebarSearchChange(this.value);
367
371
  this.submitSearch();
368
372
  }
369
373