From 5385847485dcb1302f8016f074831eb7fe5e20d1 Mon Sep 17 00:00:00 2001 From: vinu-deriv Date: Wed, 4 Dec 2024 15:31:21 +0400 Subject: [PATCH] fix: fix the consition if data is not compressed --- src/store/ChartState.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/store/ChartState.ts b/src/store/ChartState.ts index f46783685..8698a21c4 100644 --- a/src/store/ChartState.ts +++ b/src/store/ChartState.ts @@ -476,7 +476,12 @@ class ChartState { restoreLayout() { const id = this.mainStore.chart.chartId; const compressedLayout = createObjectFromLocalStorage(`chart-layout-${id}`); - const layout: TLayout = JSON.parse(LZString.decompress(compressedLayout ?? '')); + let layout: TLayout | null = null; + try { + layout = JSON.parse(LZString.decompress(compressedLayout ?? '')); + } catch (e) { + layout = compressedLayout; + } if (!layout) { this.clearLayout();