Skip to content

Commit

Permalink
Fix layout problem
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed May 2, 2022
1 parent d710e63 commit 5cdbd8c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/stores/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function migrateLayoutSettings() {
const STORE_LAYOUT_LOCK = 'ftLayoutLocked';

// If new does not exist
if (localStorage.getItem(STORE_LAYOUTS) === null) {
if (localStorage.getItem(STORE_DASHBOARD_LAYOUT) !== null) {
console.log('Migrating dashboard settings');
const layoutLocked = localStorage.getItem(STORE_LAYOUT_LOCK);
const tradingLayout = localStorage.getItem(STORE_TRADING_LAYOUT);
Expand Down Expand Up @@ -114,10 +114,13 @@ export const useLayoutStore = defineStore('layoutStore', {
key: STORE_LAYOUTS,
afterRestore: (context) => {
console.log('after restore - ', context.store);
if (context.store.dashboardLayout === null) {
if (
context.store.dashboardLayout === null ||
typeof context.store.dashboardLayout === 'string'
) {
context.store.dashboardLayout = JSON.parse(JSON.stringify(DEFAULT_DASHBOARD_LAYOUT));
}
if (context.store.tradingLayout === null) {
if (context.store.tradingLayout === null || typeof context.store.tradingLayout === 'string') {
context.store.tradingLayout = JSON.parse(JSON.stringify(DEFAULT_TRADING_LAYOUT));
}
},
Expand Down

0 comments on commit 5cdbd8c

Please sign in to comment.