Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: store columns while saving view and restore columns on selecting view without select columns #5647

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: add null check to prevent storing empty selectItems
  • Loading branch information
ahmadshaheer committed Sep 10, 2024
commit 8114ec5067dc1281735d76297f29b0954b32866c
7 changes: 5 additions & 2 deletions frontend/src/container/ExplorerOptions/ExplorerOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function ExplorerOptions({

const extraData = JSON.parse(currentViewDetails?.extraData ?? '{}');
ahmadshaheer marked this conversation as resolved.
Show resolved Hide resolved

if (extraData?.selectColumns) {
if (!!extraData && extraData?.selectColumns) {
ahmadshaheer marked this conversation as resolved.
Show resolved Hide resolved
localStorage.setItem(
LOCALSTORAGE.OLD_SELECT_COLUMNS,
JSON.stringify(options.selectColumns),
Expand All @@ -288,7 +288,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