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

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.114",
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,21 @@ 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?.state?.query?.q
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
+ this.engine?.state?.query?.q
147
+ );
134
148
 
135
149
  if (!this.engine) {
136
150
  return;
@@ -154,12 +168,10 @@ export default class SidebarSearch extends LightningElement {
154
168
 
155
169
  this.resultList?.subscribe(this.onResultListChange);
156
170
 
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);
171
+ console.log(
172
+ "initialized engine after sub classes created",
173
+ this.engine
174
+ );
163
175
 
164
176
  if (!this.isValueEmpty) {
165
177
  this.dispatchHighlightedTermChange();
@@ -203,6 +215,7 @@ export default class SidebarSearch extends LightningElement {
203
215
  this.dispatchOnChangeEvent(results);
204
216
  }
205
217
 
218
+ console.log("is fetching more results", this.fetchingMoreResults);
206
219
  if (!this.fetchingMoreResults) {
207
220
  this.dispatchOnLoading(isLoading);
208
221
  }