Skip to content

Commit

Permalink
[frontend] Fix localStorage useless method (#6161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedae authored Mar 1, 2024
1 parent 997bfac commit 3c61a93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ const useLocalStorage = (
if (isEmptyField(value)) {
value = initialValue;
}
if (value?.filters?.filters.length === 0 && !value.searchTerm && value?.filters?.filterGroups.length === 0) {
value = initialValue;
}
// Need to clear the local storage ?
if (!R.equals(removeEmptyFields(value), value)) {
const initialState = removeEmptyFields(value);
Expand Down
6 changes: 5 additions & 1 deletion opencti-platform/opencti-front/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export const removeEmptyFields = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Record<string, any> => {
const clone = { ...obj };
Object.keys(clone).forEach((key) => isEmptyField(clone[key]) && delete clone[key]);
Object.keys(clone).forEach((key) => {
if (typeof clone[key] !== 'string' && isEmptyField(clone[key])) {
delete clone[key];
}
});
return clone;
};

Expand Down

0 comments on commit 3c61a93

Please sign in to comment.