@salesforcedevs/dx-components 0.10.1-alpha.108 → 0.10.1-alpha.112

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.108",
3
+ "version": "0.10.1-alpha.112",
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?.query?.q === 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,6 +130,22 @@ export default class SidebarSearch extends LightningElement {
130
130
  preloadedState: this.preloadedState
131
131
  });
132
132
 
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
+ );
148
+
133
149
  if (!this.engine) {
134
150
  return;
135
151
  }
@@ -152,12 +168,10 @@ export default class SidebarSearch extends LightningElement {
152
168
 
153
169
  this.resultList?.subscribe(this.onResultListChange);
154
170
 
155
- console.log('initialized engine', this.engine);
156
-
157
- if (this.preloadedState) {
158
- console.log("updating search box", this.value);
159
- this.searchBox.updateText(this.value || "");
160
- }
171
+ console.log(
172
+ "initialized engine after sub classes created",
173
+ this.engine
174
+ );
161
175
 
162
176
  if (!this.isValueEmpty) {
163
177
  this.dispatchHighlightedTermChange();
@@ -311,9 +325,10 @@ export default class SidebarSearch extends LightningElement {
311
325
 
312
326
  private submitSearch = debounce(() => {
313
327
  if (this.searchBox) {
314
- this.searchBox.updateText(this.value || "");
315
328
  UserRecentSearches.add(this.value);
316
329
  this.updateRecentSearches();
330
+
331
+ this.searchBox.updateText(this.value || "");
317
332
  this.searchBox.submit();
318
333
  }
319
334
  }, SEARCH_DEBOUNCE_DELAY);