Skip to content

Commit

Permalink
fix: tabs order from localstorage parsing (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhngharry authored Jun 17, 2024
1 parent ba64b1c commit 49222de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ class App extends React.Component<
super(props);

// Get tabs config from local storage
const tabsString = getLocalStorageDataFromKey(LOCALSTORAGE_KEYS.tabs, null);
const tabsData = getLocalStorageDataFromKey(LOCALSTORAGE_KEYS.tabs, null);
let tabs: TabItemConfig[] = [];
try {
tabs = JSON.parse(tabsString);
if (!Array.isArray(tabs)) {
throw new Error("Could not parse marketplace tabs key");
}
Expand All @@ -59,6 +58,8 @@ class App extends React.Component<
if (tabs.filter((tab) => !tab).length > 0) {
throw new Error("Falsey marketplace tabs key");
}

tabs = tabsData;
} catch {
tabs = ALL_TABS;
localStorage.setItem(LOCALSTORAGE_KEYS.tabs, JSON.stringify(tabs));
Expand Down

0 comments on commit 49222de

Please sign in to comment.