@salesforcedevs/dx-components 0.10.1-alpha.110 → 0.10.1-alpha.111

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.110",
3
+ "version": "0.10.1-alpha.111",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -10,13 +10,13 @@ import {
10
10
  buildSearchBox,
11
11
  loadAdvancedSearchQueryActions,
12
12
  SearchEngine,
13
- SearchAppState
13
+ SearchAppState,
14
+ loadQueryActions
14
15
  } from "@coveo/headless";
15
16
  import { buildSearchEngine, getSidebarSearchParams } from "utils/coveo";
16
17
  import { RecentSearches } from "utils/recentSearches";
17
18
  import { toJson } from "utils/normalizers";
18
19
  import { Option, PopoverRequestCloseType } from "typings/custom";
19
- import pstate from './__tests__/preloadedState'
20
20
 
21
21
  const SESSION_KEY = "dx-sidebar-search-state";
22
22
 
@@ -116,7 +116,7 @@ export default class SidebarSearch extends LightningElement {
116
116
  return;
117
117
  }
118
118
  const state = JSON.parse(stringified);
119
- console.log({ state }, state?.search?.queryExecuted === this.value, this.value);
119
+ console.log({ state }, state?.search?.q === this.value, this.value);
120
120
  if (state?.query?.q === this.value) {
121
121
  this.preloadedState = state;
122
122
  }
@@ -130,7 +130,20 @@ export default class SidebarSearch extends LightningElement {
130
130
  preloadedState: this.preloadedState
131
131
  });
132
132
 
133
- console.log('initialized engine directly after engine build', this.engine);
133
+ console.log(
134
+ "initialized engine directly after engine build",
135
+ this.engine
136
+ );
137
+
138
+ if (this.preloadedState) {
139
+ const actions = loadQueryActions(this.engine);
140
+ this.engine.dispatch(actions.updateQuery({ q: this.value || "" }));
141
+ }
142
+
143
+ console.log(
144
+ "initialized engine directly after query dispatch",
145
+ this.engine
146
+ );
134
147
 
135
148
  if (!this.engine) {
136
149
  return;
@@ -154,12 +167,10 @@ export default class SidebarSearch extends LightningElement {
154
167
 
155
168
  this.resultList?.subscribe(this.onResultListChange);
156
169
 
157
- if (this.preloadedState) { // remove this block
158
- console.log("updating search box", this.value);
159
- this.searchBox.updateText(this.value || "");
160
- }
161
-
162
- console.log('initialized engine after sub classes created', this.engine);
170
+ console.log(
171
+ "initialized engine after sub classes created",
172
+ this.engine
173
+ );
163
174
 
164
175
  if (!this.isValueEmpty) {
165
176
  this.dispatchHighlightedTermChange();