@easyvision/easyvision-ui 1.7.3 → 1.7.4

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/README.md CHANGED
@@ -943,13 +943,15 @@ What changes in `'eager'` mode (api only):
943
943
 
944
944
  Use `'eager-ids'` when the consumer only needs ids (bulk action by id, export by id, submit-by-id) and selections can reach the tens of thousands — `'eager'` would carry every row object across all pages, which is wasteful at that scale.
945
945
 
946
+ **Wire-level payload reduction.** During eager-ids resolution the table sets `idsOnly: true` on each `fetchData` call. The built-in loopback adapter honors this by requesting `fields: ['id']` and dropping `include` for those calls — so the server returns only id objects, not full rows, dramatically shrinking the network payload for large selections. Custom `fetchData` implementations can read `params.idsOnly` and apply the same optimization (or ignore it — they'll still work, just sending more bytes than needed). The loopback adapter accepts an `idFields?: string[]` option (defaults to `['id']`) if your model's primary key is named differently.
947
+
946
948
  Trade-offs:
947
949
 
948
950
  | Mode | Network on select-all | Memory per selection | Reorder while selected | Untick individual rows | Best for |
949
951
  |---|---|---|---|---|---|
950
952
  | `'lazy'` (default) | none | O(page) | free | via `exceptIds` | export / submit flows; no list manipulation |
951
- | `'eager'` | one paginated sweep | O(all ids + all rows) | locked | via header toggle (adds visible rows to `exceptIds`) | preview / reorder / transform before submit; one-line consumer code |
952
- | `'eager-ids'` | one paginated sweep | O(all ids only) | locked | via header toggle (adds visible rows to `exceptIds`) | bulk action by id at scale (50k+); consumer only needs ids |
953
+ | `'eager'` | one paginated sweep, full rows | O(all ids + all rows) | locked | via header toggle (adds visible rows to `exceptIds`) | preview / reorder / transform before submit; one-line consumer code |
954
+ | `'eager-ids'` | one paginated sweep, **ids only** (loopback adapter) | O(all ids only) | locked | via header toggle (adds visible rows to `exceptIds`) | bulk action by id at scale (50k+); consumer only needs ids |
953
955
 
954
956
  Has no effect when `paginationMode === 'local'` (the table already knows the full set).
955
957
 
package/dist/index.cjs CHANGED
@@ -2011,23 +2011,26 @@ function ColumnVisibilityMenu({ table, label }) {
2011
2011
 
2012
2012
  // adapters/loopback.ts
2013
2013
  function createLoopbackTableFetcher(opts) {
2014
- const { fetchPage, fetchCount, include, fields, defaultOrder } = opts;
2014
+ const { fetchPage, fetchCount, include, fields, defaultOrder, idFields } = opts;
2015
2015
  return async ({
2016
2016
  page,
2017
2017
  itemsPerPage,
2018
2018
  sort,
2019
- filter
2019
+ filter,
2020
+ idsOnly
2020
2021
  }) => {
2021
2022
  const order = sort ? [`${sort.column} ${sort.descending ? "DESC" : "ASC"}`] : defaultOrder ?? [];
2022
2023
  const skip = (page - 1) * itemsPerPage;
2023
2024
  const where = filter?.where ?? {};
2025
+ const effectiveFields = idsOnly ? idFields ?? ["id"] : fields;
2026
+ const effectiveInclude = idsOnly ? void 0 : include;
2024
2027
  const pageFilter = {
2025
2028
  where,
2026
2029
  skip,
2027
2030
  limit: itemsPerPage,
2028
2031
  order,
2029
- ...include ? { include } : {},
2030
- ...fields ? { fields } : {}
2032
+ ...effectiveInclude ? { include: effectiveInclude } : {},
2033
+ ...effectiveFields ? { fields: effectiveFields } : {}
2031
2034
  };
2032
2035
  const [rows, count] = await Promise.all([
2033
2036
  fetchPage(pageFilter),
@@ -2315,7 +2318,8 @@ function EasyVisionTable(props) {
2315
2318
  page: p,
2316
2319
  itemsPerPage: PAGE_SIZE,
2317
2320
  sort,
2318
- filter: merged
2321
+ filter: merged,
2322
+ idsOnly: !collectRows
2319
2323
  });
2320
2324
  if (seq !== eagerSeqRef.current) return;
2321
2325
  knownTotal = result.totalCount;