@salesforcedevs/dx-components 0.53.10 → 0.53.11

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.53.10",
3
+ "version": "0.53.11",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -28,5 +28,5 @@
28
28
  "@types/lodash.get": "^4.4.6",
29
29
  "@types/vimeo__player": "^2.16.2"
30
30
  },
31
- "gitHead": "4c4e059fbd82f79db3c02c69e69d2fabc0035390"
31
+ "gitHead": "bcec1dc10a4a6b62d21cfce71d1919ebc360b966"
32
32
  }
@@ -327,35 +327,30 @@ export default class ContentArchive extends LightningElement {
327
327
  }
328
328
 
329
329
  private async fetchArchiveFilterList() {
330
- this.filtersLoading = true;
331
-
332
- if (this.dateList.length === 0) {
333
- const filterListdata = await getArchiveFilterList();
334
- this.dateList = this.splitOptionsByDate(filterListdata.dates);
335
-
336
- this.authorList = filterListdata.authors;
337
- this.categoryList = filterListdata.categories;
330
+ if (!this.dateList.length) {
331
+ this.filtersLoading = true;
332
+ const { dates, authors, categories } = await getArchiveFilterList();
333
+
334
+ this.dateList = this.splitOptionsByDate(dates);
335
+ this.authorList = authors;
336
+ this.categoryList = categories;
337
+ this.filtersLoading = false;
338
338
  }
339
-
340
- this.filtersLoading = false;
341
339
  }
342
340
 
343
341
  private async fetchPosts(numberOfPosts: number) {
344
342
  this.loading = true;
345
343
 
346
- const postData = await getArchivePosts(
344
+ const { posts, totalResults, totalPages } = await getArchivePosts(
347
345
  numberOfPosts,
348
346
  this.currentPage,
349
347
  this.cardType,
350
348
  this.selectedFilterMenuData
351
349
  );
352
350
 
353
- // get the list of filters for the filter menu
354
- this.fetchArchiveFilterList();
355
-
356
- this.posts = postData.posts;
357
- this.totalResults = postData.totalResults;
358
- this.totalPages = postData.totalPages;
351
+ this.posts = posts;
352
+ this.totalResults = totalResults;
353
+ this.totalPages = totalPages;
359
354
  this.loading = false;
360
355
  }
361
356
 
@@ -365,7 +360,7 @@ export default class ContentArchive extends LightningElement {
365
360
 
366
361
  // split filter options by year/month for nested checkboxes
367
362
  private splitOptionsByDate(dateOptions: any) {
368
- return dateOptions.reduce((acc: any, curr: any) => {
363
+ return dateOptions?.reduce((acc: any, curr: any) => {
369
364
  const date = new Date(curr.replace(/-/g, "/"));
370
365
  const month = new Intl.DateTimeFormat("en-US", {
371
366
  month: "long"
@@ -446,6 +441,7 @@ export default class ContentArchive extends LightningElement {
446
441
  }
447
442
 
448
443
  if (this.posts.length === 0) {
444
+ this.fetchArchiveFilterList();
449
445
  this.fetchPostsByCardType();
450
446
  }
451
447
  }