@rebasepro/ui 0.12.1-canary.g389e9b2 → 0.12.1-canary.g4e7bcbf

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.
@@ -1,11 +1,17 @@
1
1
  import React from "react";
2
2
  import { VirtualTableProps } from "./VirtualTableProps";
3
3
  /**
4
- * This is a Table component that allows displaying arbitrary data, not
5
- * necessarily related to entities or properties. It is the component
6
- * that powers the entity collections but has a generic API, so it
7
- * can be reused.
4
+ * `React.memo` is not generic-preserving: it takes the props type as its own
5
+ * type argument, so annotating the call with
6
+ * `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and
7
+ * discarded the `<T>` the inner function declares. The exported component was
8
+ * therefore not generic at all — every consumer got `Record<string, unknown>`,
9
+ * `columns` and `cellRenderer` were unrelated to `data`, and a caller writing
10
+ * `<VirtualTable<Post> …>` was told the component expects no type arguments.
8
11
  *
9
- * @group Components
12
+ * Re-asserting the call signature is the standard way to carry a type parameter
13
+ * across `memo`; it is the only cast here, and it restores the generic the
14
+ * implementation always had. Runtime behaviour is unchanged — this is the same
15
+ * memoized component under a type that describes it.
10
16
  */
11
- export declare const VirtualTable: React.NamedExoticComponent<VirtualTableProps<Record<string, unknown>>>;
17
+ export declare const VirtualTable: <T extends Record<string, unknown>>(props: VirtualTableProps<T>) => React.ReactElement | null;
package/dist/index.es.js CHANGED
@@ -5987,12 +5987,18 @@ var innerElementType = forwardRef(({ children, ...rest }, ref) => {
5987
5987
  } });
5988
5988
  });
5989
5989
  /**
5990
- * This is a Table component that allows displaying arbitrary data, not
5991
- * necessarily related to entities or properties. It is the component
5992
- * that powers the entity collections but has a generic API, so it
5993
- * can be reused.
5990
+ * `React.memo` is not generic-preserving: it takes the props type as its own
5991
+ * type argument, so annotating the call with
5992
+ * `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and
5993
+ * discarded the `<T>` the inner function declares. The exported component was
5994
+ * therefore not generic at all — every consumer got `Record<string, unknown>`,
5995
+ * `columns` and `cellRenderer` were unrelated to `data`, and a caller writing
5996
+ * `<VirtualTable<Post> …>` was told the component expects no type arguments.
5994
5997
  *
5995
- * @group Components
5998
+ * Re-asserting the call signature is the standard way to carry a type parameter
5999
+ * across `memo`; it is the only cast here, and it restores the generic the
6000
+ * implementation always had. Runtime behaviour is unchanged — this is the same
6001
+ * memoized component under a type that describes it.
5996
6002
  */
5997
6003
  var VirtualTable = React.memo(function VirtualTable({ data, onResetPagination, onEndReached, endOffset = 600, rowHeight = 54, headerHeight = 48, columns: columnsProp, onRowClick, onColumnResize, onColumnResizeEnd, filter: filterInput, checkFilterCombination, onFilterUpdate, sortBy, error, emptyComponent, onSortByUpdate, onScroll: onScrollProp, loading, cellRenderer, hoverRow, createFilterField, rowClassName, style, className, endAdornment, AddColumnComponent, initialScroll = 0, onColumnsOrderChange, extraData }) {
5998
6004
  const sortByProperty = sortBy ? sortBy[0] : void 0;