diff --git a/src/core/components/NotificationDesign/AskForKeepData.jsx b/src/core/components/NotificationDesign/AskForKeepData.jsx index 118ccc2..e6fa9f3 100644 --- a/src/core/components/NotificationDesign/AskForKeepData.jsx +++ b/src/core/components/NotificationDesign/AskForKeepData.jsx @@ -7,10 +7,27 @@ import { toast } from "react-toastify"; import useTableSetting from "@/lib/hooks/useTableSetting"; import { flattenObjectOfObjects } from "@/core/utils/flattenObjectOfObjects"; +function filterFalseValues(obj) { + const result = {}; + + for (const [key, value] of Object.entries(obj)) { + if (value === false) { + result[key] = false; + } else if (typeof value === 'object' && value !== null && !Array.isArray(value)) { + const nested = filterFalseValues(value); + if (Object.keys(nested).length > 0) { + result[key] = nested; + } + } + } + + return result; +} + function AskForKeepData({ filterData, sortData, hideData, user_id, page_name, table_name, columns }) { const { filterAction, sortAction, hideAction } = useTableSetting(); - const filteredHideData = Object.fromEntries(Object.entries(hideData).filter(([key, value]) => value === false)); + const filteredHideData = filterFalseValues(hideData); const flattenHideData = flattenObjectOfObjects(filteredHideData);