@salesforcedevs/dx-components 1.28.7-alpha.3 → 1.28.7-alpha.4
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": "1.28.7-alpha.
|
|
3
|
+
"version": "1.28.7-alpha.4",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"luxon": "3.4.4",
|
|
45
45
|
"msw": "^2.12.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "d329feb4c9c677552c504edb326c80cfa437b81d"
|
|
48
48
|
}
|
|
@@ -43,6 +43,18 @@ function getQueryFromUrl(): string {
|
|
|
43
43
|
if (qFromSearch) {
|
|
44
44
|
return qFromSearch;
|
|
45
45
|
}
|
|
46
|
+
// Support #q= (e.g. from dx-header: /search#q=example)
|
|
47
|
+
const hash = window.location.hash.slice(1);
|
|
48
|
+
if (hash) {
|
|
49
|
+
try {
|
|
50
|
+
const qFromHash = new URLSearchParams(hash).get("q");
|
|
51
|
+
if (qFromHash) {
|
|
52
|
+
return qFromHash;
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
/* ignore */
|
|
56
|
+
}
|
|
57
|
+
}
|
|
46
58
|
return "";
|
|
47
59
|
}
|
|
48
60
|
|
|
@@ -215,11 +227,31 @@ export default class SearchResults extends LightningElement {
|
|
|
215
227
|
}
|
|
216
228
|
}
|
|
217
229
|
|
|
230
|
+
private hasRunInitialSearch = false;
|
|
231
|
+
|
|
218
232
|
connectedCallback() {
|
|
219
233
|
const q = getQueryFromUrl();
|
|
220
234
|
if (q) {
|
|
221
235
|
this._query = q;
|
|
222
|
-
|
|
236
|
+
this.hasRunInitialSearch = true;
|
|
237
|
+
this.doFetch();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
renderedCallback() {
|
|
242
|
+
// Run search on first render if URL has q and we haven't yet (handles #q=, SPA nav, or late URL)
|
|
243
|
+
if (this.hasRunInitialSearch) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const q = getQueryFromUrl();
|
|
247
|
+
if (!q) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.hasRunInitialSearch = true;
|
|
251
|
+
if (this._query !== q) {
|
|
252
|
+
this._query = q;
|
|
253
|
+
}
|
|
254
|
+
if (!this.hasSearched && !this.isLoading) {
|
|
223
255
|
this.doFetch();
|
|
224
256
|
}
|
|
225
257
|
}
|