Skip to content

Commit

Permalink
fix: fix the consition if data is not compressed
Browse files Browse the repository at this point in the history
  • Loading branch information
vinu-deriv committed Dec 4, 2024
1 parent 512cd4b commit 5385847
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/store/ChartState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5385847

Please sign in to comment.