Skip to content

Commit

Permalink
fix: add null check to prevent storing empty selectItems
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer committed Aug 6, 2024
1 parent 0ecb1d2 commit 0cc0c18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function ExplorerOptions({

const extraData = JSON.parse(currentViewDetails?.extraData ?? '{}');

if (extraData?.selectColumns) {
if (!!extraData && extraData?.selectColumns) {
localStorage.setItem(
LOCALSTORAGE.OLD_SELECT_COLUMNS,
JSON.stringify(options.selectColumns),
Expand All @@ -261,7 +261,10 @@ function ExplorerOptions({
const oldSelectColumns = JSON.parse(
localStorage.getItem(LOCALSTORAGE.OLD_SELECT_COLUMNS) ?? '{}',
);
if (!isEqual(oldSelectColumns, options.selectColumns)) {
if (
Object.keys(oldSelectColumns).length &&
!isEqual(oldSelectColumns, options.selectColumns)
) {
handleOptionsChange({
...options,
selectColumns: oldSelectColumns,
Expand Down

0 comments on commit 0cc0c18

Please sign in to comment.