@open-mercato/ui 0.6.7-develop.6842.1.8cd8a8883c → 0.6.7-develop.6859.1.e4727b568a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1231,18 +1231,19 @@ function DataTable({
1231
1231
  return changed ? filtered : prev;
1232
1232
  });
1233
1233
  }, [table, mergedColumns]);
1234
- const initialVisibilityApplied = React.useRef(Boolean(mergedInitialSettings?.columnVisibility));
1234
+ const visibilitySeededByStoredSettings = React.useRef(Boolean(mergedInitialSettings?.columnVisibility));
1235
+ const autoHiddenColumnIds = React.useRef(/* @__PURE__ */ new Set());
1235
1236
  React.useEffect(() => {
1236
- if (initialVisibilityApplied.current) return;
1237
+ if (visibilitySeededByStoredSettings.current) return;
1237
1238
  const hidden = {};
1238
1239
  table.getAllLeafColumns().forEach((column) => {
1239
1240
  const hiddenMeta = column.columnDef?.meta?.hidden;
1240
- if (hiddenMeta) hidden[column.id] = false;
1241
+ if (!hiddenMeta || autoHiddenColumnIds.current.has(column.id)) return;
1242
+ hidden[column.id] = false;
1243
+ autoHiddenColumnIds.current.add(column.id);
1241
1244
  });
1242
- if (Object.keys(hidden).length) {
1243
- setColumnVisibility((prev) => ({ ...hidden, ...prev }));
1244
- }
1245
- initialVisibilityApplied.current = true;
1245
+ if (!Object.keys(hidden).length) return;
1246
+ setColumnVisibility((prev) => ({ ...hidden, ...prev }));
1246
1247
  }, [table, mergedColumns]);
1247
1248
  const getCurrentSettings = React.useCallback(() => {
1248
1249
  const visibility = {};