@payglocal_ui/flux-ui 0.2.0 → 0.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payglocal_ui/flux-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Flux UI primitives — inputs, fields, dialog, data table, charts, calendar, and more (Tailwind v4 + Radix).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -107,6 +107,18 @@ export function DataTable<T>({
107
107
  const totalPages = Math.ceil(total / pageSize);
108
108
  const paginated = isControlled ? data : data.slice((page - 1) * pageSize, page * pageSize);
109
109
 
110
+ // Guard against duplicate / non-unique rowKey() results. React silently fails
111
+ // to unmount old <tr> nodes when sibling keys collide, leaving stale rows
112
+ // rendered on top of new data (or the empty state). De-dupe by suffixing
113
+ // repeats so every rendered row gets a unique, stable key.
114
+ const seenKeys = new Map<string, number>();
115
+ const rowKeys = paginated.map((row) => {
116
+ const base = rowKey(row);
117
+ const seen = seenKeys.get(base) ?? 0;
118
+ seenKeys.set(base, seen + 1);
119
+ return seen === 0 ? base : `${base}__${seen}`;
120
+ });
121
+
110
122
  const comfortable = density === "comfortable";
111
123
  const compact = density === "compact";
112
124
  const compactCellPad = compact
@@ -220,7 +232,7 @@ export function DataTable<T>({
220
232
  ) : (
221
233
  paginated.map((row, i) => (
222
234
  <tr
223
- key={rowKey(row)}
235
+ key={rowKeys[i]}
224
236
  className={cn(
225
237
  "group transition-colors duration-150 border-b border-border/60 last:border-b-0",
226
238
  comfortable && "min-h-[56px]",