@salesforcedevs/dw-components 1.3.45-alpha.0 → 1.3.45-alpha.1

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/dw-components",
3
- "version": "1.3.45-alpha.0",
3
+ "version": "1.3.45-alpha.1",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -4,7 +4,7 @@
4
4
  <dx-tab-panel-list
5
5
  tabs={tabLabels}
6
6
  onchange={handleTabChange}
7
- initial-index={storedTabIndex}
7
+ initial-index={activeTabIndex}
8
8
  >
9
9
  <template for:each={trials} for:item="trial">
10
10
  <dx-tab-panel key={trial.label}>
@@ -1,7 +1,7 @@
1
1
  import { LightningElement, api, track } from "lwc";
2
2
  import { toJson } from "dxUtils/normalizers";
3
3
 
4
- const LOCAL_STORAGE_KEY = "storedTabIndex";
4
+ const STORED_TAB_SELECTED_KEY = "storedTabIndex";
5
5
 
6
6
  export default class BrowseTrials extends LightningElement {
7
7
  @api title = "Browse Trials";
@@ -53,7 +53,6 @@ export default class BrowseTrials extends LightningElement {
53
53
  private _filteredCategories!: Array<any>;
54
54
 
55
55
  private activeTabIndex = 0;
56
- private storedTabIndex;
57
56
  private buttonLabels!: string[][];
58
57
  private _filteredTitles!: string[][];
59
58
  private tabLabels!: Array<{ label: string }>;
@@ -67,14 +66,17 @@ export default class BrowseTrials extends LightningElement {
67
66
  ];
68
67
 
69
68
  connectedCallback() {
70
- this.storedTabIndex = window.localStorage.getItem(LOCAL_STORAGE_KEY);
71
- window.localStorage.removeItem(LOCAL_STORAGE_KEY);
69
+ const storedTabIndex = window.localStorage.getItem(
70
+ STORED_TAB_SELECTED_KEY
71
+ );
72
+ if (storedTabIndex) {
73
+ this.activeTabIndex = +storedTabIndex;
74
+ }
72
75
  }
73
76
 
74
77
  handleTabChange(e: CustomEvent) {
75
78
  this.activeTabIndex = e.detail;
76
- window.localStorage.setItem(LOCAL_STORAGE_KEY, e.detail);
77
- console.log("handleTabChange", e.detail);
79
+ window.localStorage.setItem(STORED_TAB_SELECTED_KEY, e.detail);
78
80
  }
79
81
 
80
82
  filterCategories() {