diff --git a/.github/workflows/pr-preview-build.yml b/.github/workflows/pr-preview-build.yml index ad0cebe..a973013 100644 --- a/.github/workflows/pr-preview-build.yml +++ b/.github/workflows/pr-preview-build.yml @@ -8,6 +8,6 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: gravity-ui/preview-build-action@v1 + - uses: gravity-ui/preview-build-action@v2 with: node-version: 20 diff --git a/src/utils/getAriaRowIndexMap.ts b/src/utils/getAriaRowIndexMap.ts index f306be0..3bf4868 100644 --- a/src/utils/getAriaRowIndexMap.ts +++ b/src/utils/getAriaRowIndexMap.ts @@ -1,20 +1,20 @@ import type {Row} from '@tanstack/react-table'; export const getAriaRowIndexMap = (rows: Row[]) => { + const map: Record = {}; let rowIndex = 1; - return rows.reduce>((acc, row, index, arr) => { - const newMap = { - ...acc, - [row.id]: rowIndex, - }; + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; + const nextRow = rows[i + 1]; + + map[row.id] = rowIndex; - const nextRow = arr[index + 1]; if (nextRow?.parentId !== row.id) { rowIndex += row.getLeafRows().length; } rowIndex++; + } - return newMap; - }, {}); + return map; };