@rickcedwhat/playwright-smart-table 6.25.0-next.f72ee4c → 6.25.0-next.fa652fc

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.
@@ -3,7 +3,7 @@ import { FinalTableConfig, Selector, SmartRow, FilterValue } from '../types';
3
3
  import { FilterEngine } from '../filterEngine';
4
4
  import { TableMapper } from './tableMapper';
5
5
  import { SmartRowArray } from '../utils/smartRowArray';
6
- import type { NavigationBarrier } from '../utils/navigationBarrier';
6
+ import { NavigationBarrier } from '../utils/navigationBarrier';
7
7
  export declare class RowFinder<T = any> {
8
8
  private rootLocator;
9
9
  private config;
@@ -5,6 +5,7 @@ const debugUtils_1 = require("../utils/debugUtils");
5
5
  const smartRowArray_1 = require("../utils/smartRowArray");
6
6
  const elementTracker_1 = require("../utils/elementTracker");
7
7
  const sentinel_1 = require("../utils/sentinel");
8
+ const navigationBarrier_1 = require("../utils/navigationBarrier");
8
9
  const rowResolution_1 = require("./rowResolution");
9
10
  const resolveCellLocator_1 = require("../utils/resolveCellLocator");
10
11
  const scanPages_1 = require("./scanPages");
@@ -171,23 +172,26 @@ class RowFinder {
171
172
  const newIndices = await tracker.getUnseenIndices(rowLocators);
172
173
  const currentRows = await rowLocators.all();
173
174
  let added = 0;
175
+ const useBarrier = this.config.concurrency === 'synchronized' && newIndices.length > 1;
176
+ const barrier = useBarrier ? new navigationBarrier_1.NavigationBarrier(newIndices.length) : undefined;
174
177
  for (const idx of newIndices) {
175
178
  const resolved = await (0, rowResolution_1.resolveLogicalRowIndex)(currentRows[idx], this.config, () => allRows.length);
176
179
  const rowLocator = this.nameFilteredRow(currentRows[idx], resolved, filtersRecord);
177
- // These rows outlive the scan and may be consumed individually. Only
178
- // iteration engines that own every callback can attach a batch barrier.
179
- const smartRow = this.makeSmartRow(rowLocator, map, resolved === null || resolved === void 0 ? void 0 : resolved.index, this.tableState.currentPageIndex, undefined, resolved === null || resolved === void 0 ? void 0 : resolved.selector);
180
+ const smartRow = this.makeSmartRow(rowLocator, map, resolved === null || resolved === void 0 ? void 0 : resolved.index, this.tableState.currentPageIndex, barrier, resolved === null || resolved === void 0 ? void 0 : resolved.selector);
180
181
  const loadingOutcome = await (0, rowResolution_1.resolveRowLoading)(smartRow, this.config.strategies.loading, 'skip', (msg) => (0, debugUtils_1.logDebug)(this.config, 'verbose', `findRows: ${msg}`));
181
182
  if (loadingOutcome !== 'process') {
183
+ barrier === null || barrier === void 0 ? void 0 : barrier.markFinished();
182
184
  if (loadingOutcome === 'throw') {
183
185
  throw new Error(`[SmartTable] Row ${allRows.length} did not finish loading within ${(_a = this.config.strategies.loading) === null || _a === void 0 ? void 0 : _a.rowLoadingTimeout}ms`);
184
186
  }
185
187
  continue;
186
188
  }
187
189
  if (hasOverrideFilters && !await this.matchesOverrideFilters(currentRows[idx], overrideFilters, map, (_c = options === null || options === void 0 ? void 0 : options.exact) !== null && _c !== void 0 ? _c : false)) {
190
+ barrier === null || barrier === void 0 ? void 0 : barrier.markFinished();
188
191
  continue;
189
192
  }
190
193
  if (hasSyntheticFilters && !await this.matchesSyntheticFilters(currentRows[idx], syntheticFilters, map, (_d = options === null || options === void 0 ? void 0 : options.exact) !== null && _d !== void 0 ? _d : false)) {
194
+ barrier === null || barrier === void 0 ? void 0 : barrier.markFinished();
191
195
  continue;
192
196
  }
193
197
  allRows.push(smartRow);
@@ -3,4 +3,4 @@
3
3
  * Generated by scripts/embed-version.mjs from package.json
4
4
  */
5
5
  /** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
6
- export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.25.0-next.f72ee4c";
6
+ export declare const PLAYWRIGHT_SMART_TABLE_VERSION: "6.25.0-next.fa652fc";
@@ -6,4 +6,4 @@ exports.PLAYWRIGHT_SMART_TABLE_VERSION = void 0;
6
6
  * Generated by scripts/embed-version.mjs from package.json
7
7
  */
8
8
  /** Semver of this package. Use in logs or diagnostics to confirm the installed build. */
9
- exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.25.0-next.f72ee4c";
9
+ exports.PLAYWRIGHT_SMART_TABLE_VERSION = "6.25.0-next.fa652fc";
package/dist/types.d.ts CHANGED
@@ -910,8 +910,6 @@ export interface TableResult<T = any> extends AsyncIterable<{
910
910
  /**
911
911
  * ASYNC: Searches for all matching rows across pages using pagination.
912
912
  * Auto-initializes the table if not already initialized.
913
- * Returned rows can be read independently, including with `concurrency: 'synchronized'`.
914
- * Use synchronized `map()` for coordinated column scrolling across virtualized rows.
915
913
  * @param filters - The filter criteria to match (omit or pass {} for all rows)
916
914
  * @param options - Search options (exact, maxPages). `useBulkPagination` defaults to `false`: pages advance one at a time via `goNext` so no intermediate page is skipped. Set it to `true` to opt into `goNextBulk` (faster, but skips the rows on jumped-over pages). `signal` cancels the page scan; the call rejects with `signal.reason`.
917
915
  */
@@ -4,7 +4,7 @@ import { SmartRow } from '../types';
4
4
  */
5
5
  export interface SmartRowArray<T = any> extends Array<SmartRow<T>> {
6
6
  /**
7
- * Converts all rows to JSON objects, reading sequentially to avoid competing viewport moves.
7
+ * Converts all rows to JSON objects
8
8
  */
9
9
  toJSON(): Promise<T[]>;
10
10
  }
@@ -7,10 +7,7 @@ exports.createSmartRowArray = createSmartRowArray;
7
7
  function createSmartRowArray(rows) {
8
8
  const arr = rows;
9
9
  arr.toJSON = async () => {
10
- const results = [];
11
- for (const row of rows)
12
- results.push(await row.toJSON());
13
- return results;
10
+ return Promise.all(rows.map(r => r.toJSON()));
14
11
  };
15
12
  return arr;
16
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rickcedwhat/playwright-smart-table",
3
- "version": "6.25.0-next.f72ee4c",
3
+ "version": "6.25.0-next.fa652fc",
4
4
  "description": "Smart, column-aware table interactions for Playwright",
5
5
  "author": "Cedrick Catalan",
6
6
  "license": "MIT",