Skip to content

Commit

Permalink
fix columns conflict (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinsonneau authored Feb 2, 2024
1 parent e67dc95 commit a34b76c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions web/src/components/modals/export-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ export const ExportModal: React.FC<ExportModalProps> = ({
}, [isExportAll, selectedColumns]);

React.useEffect(() => {
// reload selected columns when config is loaded
setSelectedColumns(
getLocalStorage(LOCAL_STORAGE_EXPORT_COLS_KEY, columns, {
id: 'id',
criteria: 'isSelected'
})
);
// reload selected columns when config is loaded and popup closed
if (!isModalOpen) {
setSelectedColumns(
getLocalStorage(LOCAL_STORAGE_EXPORT_COLS_KEY, _.cloneDeep(columns), {
id: 'id',
criteria: 'isSelected'
})
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [columns]);
}, [isModalOpen, columns]);

return (
<Modal
Expand Down

0 comments on commit a34b76c

Please sign in to comment.