Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat(tables): the row count is exact at any size; above 1,000 rows it loads in a second request after page 1
aashu8e061fd3fb1f
diff --git a/.ai/specs/2026-10-13-infinite-scroll-tables.md b/.ai/specs/2026-10-13-infinite-scroll-tables.mdindex fc16ff6e09..36cfa2ce0d 100644--- a/.ai/specs/2026-10-13-infinite-scroll-tables.md+++ b/.ai/specs/2026-10-13-infinite-scroll-tables.md@@ -124,7 +124,7 @@ The sticky header, pinned columns and edge shadows stay as they are. The prefetcThe `<Pagination>` bar, page-size dropdown and Prev/Next buttons go away. The ArrowLeft / ArrowRight pagination shortcuts go away. The table header shows the total:- An exact number below 1,000 rows: "245 rows".-- "about 2,300 rows" at 1,000 rows or more, because `LIST_COUNT` is an estimate there.+- At 1,000 rows or more, "about 2,300 rows" while `LIST_COUNT` (an estimate there) is all the page has, then the exact number ("2,317 rows"). A second request (`?count=exact`) gets it after page 1 shows, so the rows never wait for it.### 7. Selection and "Select all matching"@@ -199,7 +199,7 @@ After every list is converted, delete `usePagination`, `<Pagination>`, `PAGE_SIZ| 4 | When to prefetch | 600px from the bottom | The user does not feel a wait. User decision. || 5 | Page size | 100 rows, fixed | Matches `DEFAULT_PAGE_SIZE`. Below PostgREST `max_rows = 1000`. || 6 | Sort by another table's column (7 tables) | Turn off those sorts | No database change. User decision. |-| 7 | Row count in the header | Exact below 1,000, "about N" above | `LIST_COUNT` is an estimate past 1,000. User decision. |+| 7 | Row count in the header | Exact at any size: "about N" only until the exact count arrives | Users need the exact number of records. An exact count reads every matching row, so it runs in its own request after page 1 (`useExactCount`) instead of slowing page 1. User decision (revised). || 8 | Select all | Gmail-style "Select all N matching" bar, no cap. Exception: Jobs Release and Batches Release act on at most 2,000 rows in the background | User decision. The 2,000 cap: Review fix D, because each released job runs MRP. || 9 | Browser or server for "all matching" work | Browser up to 1,000 rows; Inngest job above 1,000 | Small lists stay instant. Journals and ledgers pass 10,000 rows (research file). User decision. || 10 | CSV export | All matching rows, visible columns only. Big exports hold plain DB values | The on-screen format code runs only in the browser. User decision. |@@ -259,7 +259,7 @@ N/A for a record type. Code precedent:- [ ] Inline editing on a table with `withInlineEditing` keeps the selected cell while the user scrolls far away and back.- [ ] Pinned columns and the sticky header stay in place while rows load and scroll.- [ ] On a phone (< 48rem), the compact list loads more rows on scroll, with no "Load more" button.-- [ ] The header shows "245 rows" for 245 rows and "about 2,300 rows" for an estimated 2,300.+- [ ] The header shows "245 rows" for 245 rows. For 2,317 rows it shows "about 2,300 rows" at first, then "2,317 rows".- [ ] On Jobs with 800 matching jobs, "Select all 800 matching" then Release releases every Draft and Planned job in the browser path.- [ ] On Jobs with 3,000 matching jobs, "Select all 3,000 matching" then Release starts one background job. It releases only Draft and Planned jobs and notifies the user with the counts.- [ ] CSV export of 800 matching rows downloads at once, with on-screen formatting and only the visible columns.@@ -306,7 +306,7 @@ Check in a browser after `crbn up`, in this order:- [x] Reuse the route loader or add API routes? — **Answer:** Reuse the route loader (option A). New API routes would duplicate the loaders.- [x] What replaces the pager's "1–100 of N"? — **Answer:** A row total in the table header.- [x] Sorts by another table's column? — **Answer:** Turn off those sorts.-- [x] Row count wording? — **Answer:** Exact below 1,000, "about N" above.+- [x] Row count wording? — **Answer:** Exact below 1,000, "about N" above. **Revised:** exact at any size; above 1,000 the exact count loads in a second request after page 1.- [x] What does "select all" select? — **Answer:** Every matching row, through a Gmail-style "Select all N matching" bar.- [x] What does CSV export download? — **Answer:** All matching rows. Columns stay WYSIWYG.- [x] Load-all cap? — **Answer:** First 5,000 rows in the browser. Then changed: the research suggests journals pass 10,000 rows, so work above 1,000 rows moves to the server.diff --git a/.claude/rules/database-patterns.md b/.claude/rules/database-patterns.mdindex 9a8047148f..cc29fd0fa1 100644--- a/.claude/rules/database-patterns.md+++ b/.claude/rules/database-patterns.md@@ -102,7 +102,7 @@ Conventions (see also `conventions-services.md`):- Always scope list queries by `companyId` (`.eq("companyId", companyId)`) — defense in depth even though RLS also enforces it.- List endpoints take `GenericQueryFilters` and run through `setGenericQueryFilters(query, args, [...])` (`~/utils/query`) for search/sort/pagination.-- Count/select for list endpoints: prefer `{ count: LIST_COUNT }` (`LIST_COUNT = "estimated"`, `~/utils/query`) over `count: "exact"`. `exact` is `COUNT(*) OVER ()`, which materializes the whole filtered set just to produce a total the UI shows approximately anyway — on 500k `trackedEntity` rows that is 652 ms vs 1.5 ms. `estimated` is a hybrid: PostgREST still returns an exact count below its threshold, so small tenants see no change. Currently used by the ten view-backed endpoints plus `getJobs` and `getTrackedEntities`.+- Count/select for list endpoints: prefer `{ count: LIST_COUNT }` (`LIST_COUNT = "estimated"`, `~/utils/query`) over `count: "exact"` (a paged list counts with `listCount(args)`, which asks for `exact` only in the Table's separate count request; see `table-infinite-scroll.md`). `exact` is `COUNT(*) OVER ()`, which materializes the whole filtered set just to produce a total the UI shows approximately anyway — on 500k `trackedEntity` rows that is 652 ms vs 1.5 ms. `estimated` is a hybrid: PostgREST still returns an exact count below its threshold, so small tenants see no change. Currently used by the ten view-backed endpoints plus `getJobs` and `getTrackedEntities`.- The ten endpoints backed by the big multi-join **views** (`parts`, `materials`, `tools`, `consumables`, `services`, `purchaseOrders`, `quotes`, `salesOrders`, `purchaseInvoices`, `salesInvoices`) additionally select an explicit `*_LIST_COLUMNS` constant instead of `select("*")`, so Postgres can prune the views' unreferenced computed columns. Adding a column to one of those tables means adding it to the constant — `apps/erp/test/list-select-columns.test.ts` fails if an `accessorKey` is missing, because the CSV export reads accessors untyped. The rationale lives once on `LIST_COUNT` in `apps/erp/app/utils/query.ts`, not at each constant.- Use `sanitize(...)` (re-exported from `@carbon/utils`) to strip empty values before insert/update.- Upserts are done either with a manual `id ? update : insert` branch or supabase's native `.upsert(...)`; both are in use.diff --git a/.claude/rules/table-infinite-scroll.md b/.claude/rules/table-infinite-scroll.mdindex 9e87149398..6845501f84 100644--- a/.claude/rules/table-infinite-scroll.md+++ b/.claude/rules/table-infinite-scroll.md@@ -47,6 +47,31 @@ request's order gives an empty page, so the list ends rather than restarting.A list that pages by offset (printing jobs, the audit log) uses`encodeOffsetToken` / `decodeOffsetToken`, not a cursor.+## The row count++The header shows the number of matching rows ("2,345 rows"), exact at any size.++1. Page 1 asks for `LIST_COUNT` (`estimated`). PostgREST counts exactly below+ 1,000 rows. From 1,000 rows up it gives the planner's estimate, because an+ exact count (`COUNT(*) OVER ()`) reads every matching row.+2. From 1,000 up, `useExactCount` (`components/Table/useExactCount.ts`) loads+ the list route with `count=exact` in place of `after` (`getCountUrl`),+ after page 1 shows and again after each revalidation. The rows never wait+ for the count.+3. `getGenericQueryFilters` reads `count=exact` as `exactCount: true` (and no+ cursor). `listCount(args)` then asks for `exact`, and+ `setGenericQueryFilters` reads one row (`.limit(1)`).+4. `loadListPage` answers that request with the count only: no `firstPage`,+ no `mapRows`, `{ [dataKey]: [], count, exactCount: true }`. A loader that+ calls `fetchListPage` itself returns `exactCount: page.exactCount`.+5. Until the answer comes, the copy says "about" (header, phone footer,+ select-all bar). A failed request keeps the estimate.++Only a list with `listKey` asks, and only an answer with `exactCount: true`+counts. A loader that builds its own args from `getGenericQueryFilters`+(`{ limit, cursor, sorts, filters }`) drops `exactCount`, so its count stays+the estimate rather than showing an estimate as exact.+## Loader recipe (a registered list)```ts@@ -141,7 +166,7 @@ export const SALES_ORDERS_PAGING: Paging = {export async function getSalesOrders(client, companyId, args: GenericQueryFilters & { … }) {let query = client.from("salesOrders")- .select(SALES_ORDERS_LIST_COLUMNS, { count: args.cursor ? undefined : LIST_COUNT })+ .select(SALES_ORDERS_LIST_COLUMNS, { count: listCount(args) }).eq("companyId", companyId);// filters, search …query = setGenericQueryFilters(query, args, SALES_ORDERS_PAGING);@@ -165,7 +190,7 @@ Rules for the query:| Rule | Why ||---|---|-| Ask for the count only when `args.cursor` is null | Later pages need no count. `fetchListPage` returns 0 for them. |+| Count with `listCount(args)` | `LIST_COUNT` on page 1, no count on a later page (`fetchListPage` returns 0), `exact` for the count request (see "The row count"). || Every sortable column, the default sorts and the id column are in the select | `toPage` reads the cursor values from the row. A missing one ends the list after the page and logs a warning. || Never put an `.order()` before `setGenericQueryFilters` | The cursor follows only the sorts that `setGenericQueryFilters` applies. A fixed first order breaks it. || A default sort on a `foreignTable` orders the embedded rows only | `resolveSorts` keeps it out of the keyset. |@@ -240,7 +265,7 @@ shows no "loaded rows" footer label.| 600px | `PREFETCH_DISTANCE` | Start the next page this close to the end || 20 pages | `MAX_REFRESH_PAGES` | At most 2,000 rows stay loaded after a revalidation, and in the Back memory || 1,000 | `BROWSER_ROW_LIMIT` | The browser loads at most this many rows for "select all" and CSV export |-| 1,000 | `EXACT_COUNT_LIMIT` | Below it the header count is exact ("245 rows"); from it "about N rows" (`LIST_COUNT` is an estimate there) |+| 1,000 | `EXACT_COUNT_LIMIT` | Below it the page-1 count is exact ("245 rows"). From it, `LIST_COUNT` is an estimate: "about N rows" until `useExactCount` gets the exact count || 1,000 | `SINGLE_LOAD_LIMIT` | Rows a single-load list reads || 500 | `TABLE_JOB_PAGE_SIZE` (`packages/jobs/src/table-jobs/paging.ts`) | Rows per query in a job. `limit + 1` must stay at or below PostgREST `max_rows` (1,000) || 10,000 | `TABLE_JOB_ROWS_PER_STEP` | Rows one job step reads (20 pages). One step is one HTTP request, and the load balancer cuts a request at 600 s |diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsxindex 6b50619033..c6b1e8d6af 100644--- a/apps/erp/app/components/Table/Table.tsx+++ b/apps/erp/app/components/Table/Table.tsx@@ -90,6 +90,7 @@ import type {InfiniteOptions,InfiniteRows} from "./types";+import { useExactCount } from "./useExactCount";import { useGrowOnlyColumnWidths } from "./useGrowOnlyColumnWidths";import { useInfiniteRows } from "./useInfiniteRows";import { useInfiniteScroll } from "./useInfiniteScroll";@@ -327,7 +328,7 @@ const Table = <T extends object>({data,columns,compact = false,- count = 0,+ count: loaderCount = 0,defaultColumnOrder,defaultColumnPinning,defaultColumnVisibility,@@ -409,6 +410,11 @@ const Table = <T extends object>({const infiniteOptions = infiniteRows.options;const isInfinite = !!infiniteOptions;const listKey = infiniteOptions?.listKey;+ const { count, isExact: countIsExact } = useExactCount({+ count: loaderCount,+ data,+ infinite: infiniteOptions+ });// Key rows by their id when every row has a unique one, so a selection, an// expanded row or an edit stays on its row when pages are appended.@@ -609,6 +615,7 @@ const Table = <T extends object>({<SelectAllMatchingBarselectedCount={selectedRows.length}count={count}+ countIsExact={countIsExact}{...selection.bar}/>);@@ -1241,6 +1248,7 @@ const Table = <T extends object>({titleBadge={titleBadge}table={table}count={count}+ countIsExact={countIsExact}title={currentView?.name ?? title}tableName={tableName}filters={filters}@@ -1369,6 +1377,7 @@ const Table = <T extends object>({isEmpty={isTableEmpty}importCSV={importCSV}count={count}+ countIsExact={countIsExact}primaryAction={headerPrimaryAction}headerActions={headerActions}renderActions={scopedRenderActions}diff --git a/apps/erp/app/components/Table/components/Compact/CompactList.tsx b/apps/erp/app/components/Table/components/Compact/CompactList.tsxindex 83956a944a..9206effe5c 100644--- a/apps/erp/app/components/Table/components/Compact/CompactList.tsx+++ b/apps/erp/app/components/Table/components/Compact/CompactList.tsx@@ -24,7 +24,6 @@ import { BottomBar } from "~/components/Layout/Mobile/ChromeSlots";import { useSetAppBarOverride } from "~/components/Layout/Mobile/useAppBarOverride";import { useUrlParams } from "~/hooks";import type { fieldMappings } from "~/modules/shared/imports.models";-import { EXACT_COUNT_LIMIT } from "../../infiniteRowsStore";import type { InfiniteRows } from "../../types";import { findScrollParent, useInfiniteScroll } from "../../useInfiniteScroll";import { useVirtualRows } from "../../useVirtualRows";@@ -66,6 +65,8 @@ export type CompactListProps<T> = {table: Table<T>;titleBadge?: ReactNode;count: number;+ /** False while `count` is an estimate (`useExactCount`). */+ countIsExact: boolean;title?: string;tableName?: string;filters: ColumnFilter[];@@ -115,6 +116,7 @@ export type CompactListProps<T> = {export function CompactList<T>({table,count,+ countIsExact,title,tableName,filters,@@ -272,14 +274,14 @@ export function CompactList<T>({const sentinelRef = useInfiniteScroll(infinite, { root: scrollElement });const isLoadingMore = infinite?.isLoadingMore ?? false;- // "245 of 245 rows" in place of the pager: exact below 1,000, else "about".+ // "245 of 245 rows" in place of the pager: "about" until the exact count+ // arrives (`useExactCount`).// An estimate can be below the rows already loaded; it never shows less.const total = Math.max(count, rows.length);const loadedLabel = numberFormatter.format(rows.length);- const loadedOfTotal =- total < EXACT_COUNT_LIMIT- ? t`${loadedLabel} of ${plural(total, { one: "# row", other: "# rows" })}`- : t`${loadedLabel} of about ${plural(total, { one: "# row", other: "# rows" })}`;+ const loadedOfTotal = countIsExact+ ? t`${loadedLabel} of ${plural(total, { one: "# row", other: "# rows" })}`+ : t`${loadedLabel} of about ${plural(total, { one: "# row", other: "# rows" })}`;const toolbar = (<CompactToolbardiff --git a/apps/erp/app/components/Table/components/SelectAllMatching.tsx b/apps/erp/app/components/Table/components/SelectAllMatching.tsxindex 26dab54eab..211a722b5b 100644--- a/apps/erp/app/components/Table/components/SelectAllMatching.tsx+++ b/apps/erp/app/components/Table/components/SelectAllMatching.tsx@@ -9,7 +9,7 @@ import type { OnChangeFn, RowSelectionState } from "@tanstack/react-table";import { useCallback, useEffect, useMemo, useState } from "react";import { useLocation } from "react-router";import type { TableJobRefusal } from "~/utils/table-jobs";-import { BROWSER_ROW_LIMIT, EXACT_COUNT_LIMIT } from "../infiniteRowsStore";+import { BROWSER_ROW_LIMIT } from "../infiniteRowsStore";import type { AllMatchingSelection, InfiniteRows } from "../types";/**@@ -24,6 +24,8 @@ type SelectAllMatchingBarProps = {selectedCount: number;/** The list's header count: exact below 1,000, else an estimate. */count: number;+ /** False while `count` is an estimate (`useExactCount`). */+ countIsExact: boolean;allMatching: AllMatchingSelection | null;offer: SelectAllOffer | null;isLoading: boolean;@@ -39,6 +41,7 @@ type SelectAllMatchingBarProps = {export function SelectAllMatchingBar({selectedCount,count,+ countIsExact,allMatching,offer,isLoading,@@ -60,11 +63,19 @@ export function SelectAllMatchingBar({{allMatching ? (<><span>- <Plural- value={allMatching.count}- one="All matching rows selected (about #)"- other="All matching rows selected (about #)"- />+ {countIsExact ? (+ <Plural+ value={count}+ one="All # matching row selected"+ other="All # matching rows selected"+ />+ ) : (+ <Plural+ value={allMatching.count}+ one="All matching rows selected (about #)"+ other="All matching rows selected (about #)"+ />+ )}</span><span aria-hidden>·</span><Button variant="link" size="sm" onClick={onClear}>@@ -85,7 +96,7 @@ export function SelectAllMatchingBar({>{offer === "first" ? (<Trans>Select the first {limit} rows</Trans>- ) : count < EXACT_COUNT_LIMIT ? (+ ) : countIsExact ? (<Pluralvalue={count}one="Select all # matching row"diff --git a/apps/erp/app/components/Table/components/TableHeader.tsx b/apps/erp/app/components/Table/components/TableHeader.tsxindex d5e115bc8f..62e5a35fef 100644--- a/apps/erp/app/components/Table/components/TableHeader.tsx+++ b/apps/erp/app/components/Table/components/TableHeader.tsx@@ -53,7 +53,6 @@ import { useSavedViews } from "~/hooks/useSavedViews";import type { fieldMappings } from "~/modules/shared/imports.models";import type { action as savedViewAction } from "~/routes/x+/shared+/views";import { path } from "~/utils/path";-import { EXACT_COUNT_LIMIT } from "../infiniteRowsStore";import Columns from "./Columns";import Download, { type InfiniteExport } from "./Download";import { ActiveFilters, Filter } from "./Filter";@@ -71,8 +70,10 @@ type HeaderProps<T> = {columnVisibility: Record<string, boolean>;columns: Column<T, unknown>[];compact?: boolean;- // The number of matching rows. Exact below 1,000; above, an estimate.+ // The number of matching rows. Exact below 1,000; above, an estimate+ // until the exact count arrives (`useExactCount`).count: number;+ countIsExact: boolean;data: object[];// Infinite lists: the export loads the rest first, or hands it to a job.infiniteExport?: InfiniteExport;@@ -125,6 +126,7 @@ const TableHeader = <T extends object>({columnVisibility,columns,count,+ countIsExact,data,infiniteExport,editMode,@@ -407,7 +409,9 @@ const TableHeader = <T extends object>({/>)}- {withPagination && count > 0 && <RowCount count={count} />}+ {withPagination && count > 0 && (+ <RowCount count={count} isExact={countIsExact} />+ )}{withInlineEditing &&!forceEditMode &&@@ -458,11 +462,11 @@ const TableHeader = <T extends object>({};// The list's total in place of the pager. `LIST_COUNT` is an estimate from-// 1,000 rows up, so the number says "about" there.-function RowCount({ count }: { count: number }) {+// 1,000 rows up, so the number says "about" until the exact count arrives.+function RowCount({ count, isExact }: { count: number; isExact: boolean }) {return (<span className="whitespace-nowrap px-2 text-sm text-muted-foreground tabular-nums">- {count < EXACT_COUNT_LIMIT ? (+ {isExact ? (<Plural value={count} one="# row" other="# rows" />) : (<Plural value={count} one="about # row" other="about # rows" />diff --git a/apps/erp/app/components/Table/infiniteRowsStore.test.ts b/apps/erp/app/components/Table/infiniteRowsStore.test.tsindex 778ab62815..5cfba0a5c8 100644--- a/apps/erp/app/components/Table/infiniteRowsStore.test.ts+++ b/apps/erp/app/components/Table/infiniteRowsStore.test.ts@@ -5,6 +5,7 @@import { beforeEach, describe, expect, it } from "vitest";import {clearInfiniteRows,+ getCountUrl,getInfiniteRows,getPageUrl,getRefreshPageCount,@@ -159,6 +160,28 @@ describe("getPageUrl", () => {});});+describe("getCountUrl", () => {+ it("asks for the exact count in place of a page, with the list's search", () => {+ const parsed = new URL(+ getCountUrl("/x/sales/orders?sort=name%3Aasc&after=old"),+ "http://localhost"+ );+ expect(parsed.pathname).toBe("/x/sales/orders");+ expect(parsed.searchParams.get("sort")).toBe("name:asc");+ expect(parsed.searchParams.has("after")).toBe(false);+ expect(parsed.searchParams.get("count")).toBe("exact");+ });++ it("keeps the naked `index` param of an index route", () => {+ const parsed = new URL(+ getCountUrl("/x/workflows?index&search=a"),+ "http://localhost"+ );+ expect(parsed.searchParams.getAll("index")).toEqual([""]);+ expect(parsed.searchParams.get("count")).toBe("exact");+ });+});+describe("getRefreshPageCount", () => {it("refreshes every loaded page up to 2,000 rows in total", () => {expect(MAX_REFRESH_PAGES).toBe(20);diff --git a/apps/erp/app/components/Table/infiniteRowsStore.ts b/apps/erp/app/components/Table/infiniteRowsStore.tsindex 60a32ce313..622d004e24 100644--- a/apps/erp/app/components/Table/infiniteRowsStore.ts+++ b/apps/erp/app/components/Table/infiniteRowsStore.ts@@ -22,7 +22,8 @@ export const BROWSER_ROW_LIMIT = 1000;/*** Below this many rows the list's count is exact. From it up, `LIST_COUNT` is- * an estimate, and the copy says "about".+ * an estimate: `useExactCount` asks for the exact count after page 1, and the+ * copy says "about" until it arrives.*/export const EXACT_COUNT_LIMIT = 1000;@@ -151,6 +152,18 @@ export function getPageUrl(routeUrl: string, cursor: string): string {return `${pathname}?${params.toString()}`;}+/**+ * The URL of the list's exact count (`useExactCount`): the list route's own+ * URL with `count=exact` in place of `after`.+ */+export function getCountUrl(routeUrl: string): string {+ const [pathname, search = ""] = routeUrl.split("?");+ const params = new URLSearchParams(search);+ params.delete("after");+ params.set("count", "exact");+ return `${pathname}?${params.toString()}`;+}+/** How many loaded pages after page 1 a revalidation fetches again. */export function getRefreshPageCount(loadedPages: number): number {return Math.max(0, Math.min(loadedPages, MAX_REFRESH_PAGES - 1));diff --git a/apps/erp/app/components/Table/useExactCount.ts b/apps/erp/app/components/Table/useExactCount.tsnew file mode 100644index 0000000000..603c4d7983--- /dev/null+++ b/apps/erp/app/components/Table/useExactCount.ts@@ -0,0 +1,65 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { useEffect, useRef, useState } from "react";+import { useFetcher, useFormAction, useLocation } from "react-router";+import {+ EXACT_COUNT_LIMIT,+ getCountUrl,+ getResetKey+} from "./infiniteRowsStore";+import type { InfiniteOptions } from "./types";++/**+ * The list's row count, exact at any size: from 1,000 rows up it asks for+ * `?count=exact` after page 1 shows, keeping the estimate until it arrives.+ * See `.claude/rules/table-infinite-scroll.md` ("The row count").+ */+export function useExactCount({+ count,+ data,+ infinite+}: {+ count: number;+ /** The loader's page 1. A new array is a new page 1. */+ data: unknown;+ infinite?: InfiniteOptions;+}): { count: number; isExact: boolean } {+ const fetcher = useFetcher<{ count?: number; exactCount?: boolean }>();+ const formAction = useFormAction();+ const location = useLocation();+ const pageUrl = infinite?.pageUrl ?? formAction;+ const resetKey = getResetKey(+ location.search,+ infinite?.pageUrl,+ infinite?.ignoreParams+ );+ const wanted = !!infinite?.listKey && count >= EXACT_COUNT_LIMIT;++ const [exact, setExact] = useState<{ resetKey: string; count: number }>();+ const requestedKey = useRef<string | null>(null);+ const load = useRef(fetcher.load);+ load.current = fetcher.load;++ // biome-ignore lint/correctness/useExhaustiveDependencies: a new page 1 (`data`) counts again+ useEffect(() => {+ if (!wanted) return;+ requestedKey.current = resetKey;+ load.current(getCountUrl(pageUrl));+ }, [wanted, resetKey, pageUrl, data]);++ useEffect(() => {+ const result = fetcher.data;+ if (fetcher.state !== "idle" || result?.exactCount !== true) return;+ if (typeof result.count !== "number" || requestedKey.current === null) {+ return;+ }+ setExact({ resetKey: requestedKey.current, count: result.count });+ }, [fetcher.state, fetcher.data]);++ if (wanted && exact?.resetKey === resetKey) {+ return { count: exact.count, isExact: true };+ }+ return { count, isExact: count < EXACT_COUNT_LIMIT };+}diff --git a/apps/erp/app/modules/accounting/accounting.service.ts b/apps/erp/app/modules/accounting/accounting.service.tsindex 4e8ca932c0..0d9469180d 100644--- a/apps/erp/app/modules/accounting/accounting.service.ts+++ b/apps/erp/app/modules/accounting/accounting.service.ts@@ -38,7 +38,7 @@ import type { z } from "zod";import { getNextSequence } from "~/modules/settings";import type { Cursor } from "~/utils/cursor";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import type {AnalyticsAccountScope,@@ -4388,7 +4388,7 @@ export async function getPaymentTerms(let query = client.from("paymentTerm").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("active", true);@@ -4729,7 +4729,7 @@ export async function getProjects() {let query = client.from("project")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).eq("active", true);@@ -4791,7 +4791,7 @@ export async function getDimensions(let query = client.from("dimension").select("*, dimensionValue(id, name)", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyGroupId", companyGroupId).eq("active", true);@@ -5620,7 +5620,7 @@ export async function getIntercompanyTransactions(.from("intercompanyTransaction").select("*, sourceCompany:company!intercompanyTransaction_sourceCompanyId_fkey(name), targetCompany:company!intercompanyTransaction_targetCompanyId_fkey(name)",- { count: args.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyGroupId", companyGroupId);@@ -5827,7 +5827,7 @@ export async function getJournalEntries() {let query = client.from("journalEntries")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -6799,7 +6799,7 @@ export async function getFixedAssetClasses(.from("fixedAssetClass").select("id, name, description, depreciationMethod, usefulLifeMonths, residualValuePercent, taxDepreciationMethod, taxUsefulLifeMonths, macrsPropertyClass",- { count: args.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyId", companyId);@@ -6896,7 +6896,7 @@ export async function getFixedAssets(let query = client.from("fixedAsset").select(FIXED_ASSETS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -7468,7 +7468,7 @@ export async function getDepreciationRuns(let query = client.from("depreciationRun").select("id, depreciationRunId, periodEnd, status, postedAt, createdAt", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -8571,7 +8571,7 @@ export async function getFleetAssets() {let query = client.from("fleetAssets")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {diff --git a/apps/erp/app/modules/documents/documents.service.ts b/apps/erp/app/modules/documents/documents.service.tsindex 58752454d8..1ae8388577 100644--- a/apps/erp/app/modules/documents/documents.service.ts+++ b/apps/erp/app/modules/documents/documents.service.ts@@ -9,7 +9,7 @@ import { trigger } from "@carbon/jobs";import type { SupabaseClient } from "@supabase/supabase-js";import type { z } from "zod";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import { getDocumentType } from "../shared/shared.service";import type {@@ -91,7 +91,7 @@ export async function getDocuments(let query = client.from("documents").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("active", args.active);diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.tsindex 198cc96efd..1e2fef8b62 100644--- a/apps/erp/app/modules/inventory/inventory.service.ts+++ b/apps/erp/app/modules/inventory/inventory.service.ts@@ -24,6 +24,7 @@ import type { StorageItem } from "~/types";import type { Filter, GenericQueryFilters, Paging } from "~/utils/query";import {LIST_COUNT,+ listCount,setGenericQueryFilters,setSearchFilter} from "~/utils/query";@@ -358,7 +359,7 @@ export async function getInventoryItems(},{// Later pages (`cursor`) skip the count: the first page already has it.- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)});@@ -552,7 +553,7 @@ export async function getKanbans(let query = client.from("kanbans").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("locationId", locationId);@@ -664,7 +665,7 @@ export async function getStockTransfers(let query = client.from("stockTransfer").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -752,7 +753,7 @@ export async function getReceipts(let query = client.from("receipt").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).neq("sourceDocumentId", "");@@ -1179,7 +1180,7 @@ export async function getStorageUnitRoots() {let query = client.from("storageUnits_recursive")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).eq("locationId", locationId).eq("depth", 1);@@ -1346,7 +1347,7 @@ export async function getStockMovements(let query = client.from("itemLedgers").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1379,7 +1380,7 @@ export async function getShipments(let query = client.from("shipment").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).neq("sourceDocumentId", "");@@ -1594,7 +1595,7 @@ export async function getShippingMethods(let query = client.from("shippingMethod").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("active", true);@@ -1708,7 +1709,7 @@ export async function getTrackedEntities(let query = client.from("trackedEntity").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).neq("status", "Reserved");@@ -1873,7 +1874,7 @@ export async function getWarehouseTransfers(.select("*, fromLocation:location!fromLocationId(name), toLocation:location!toLocationId(name)",{- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2129,7 +2130,7 @@ export async function getInventoryCounts() {let query = client.from("inventoryCount")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -2173,7 +2174,7 @@ export async function getInventoryCountLines(// apply the same generic column filters the quantities screen does.let query = client.from("inventoryCountLines")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("inventoryCountId", inventoryCountId).eq("companyId", companyId);@@ -3051,7 +3052,7 @@ export async function getStorageTypes() {let query = client.from("storageType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -3174,7 +3175,7 @@ export async function getPickingLists(let query = client.from("pickingLists").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);diff --git a/apps/erp/app/modules/invoicing/invoicing.service.ts b/apps/erp/app/modules/invoicing/invoicing.service.tsindex 202e857dcc..20c8fa9f96 100644--- a/apps/erp/app/modules/invoicing/invoicing.service.ts+++ b/apps/erp/app/modules/invoicing/invoicing.service.ts@@ -47,7 +47,7 @@ import {insertSupplierInteraction} from "~/modules/purchasing";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import { getExchangeRate } from "../accounting/accounting.service";import { getEmployeeJob } from "../people/people.service";@@ -378,7 +378,7 @@ export async function getPurchaseInvoices(let query = client.from("purchaseInvoices").select(PURCHASE_INVOICES_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -472,7 +472,7 @@ export async function getSalesInvoices(let query = client.from("salesInvoices").select(SALES_INVOICES_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1391,7 +1391,7 @@ export async function getPayments() {let query = client.from("payment")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -1452,7 +1452,7 @@ export async function getCharges() {let query = client.from("charge")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -1505,7 +1505,7 @@ export async function getReimbursements() {let query = client.from("reimbursement")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -3932,7 +3932,7 @@ export async function getMemos() {let query = client.from("memo")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.tsindex ba9fc03f24..75319006b3 100644--- a/apps/erp/app/modules/items/items.service.ts+++ b/apps/erp/app/modules/items/items.service.ts@@ -28,7 +28,7 @@ import type { z } from "zod";import { createDocumentUploadUrl } from "~/modules/documents/documents.service";import type { GenericQueryFilters, Paging } from "~/utils/query";import {- LIST_COUNT,+ listCount,setGenericQueryFilters,setSearchFilter} from "~/utils/query";@@ -901,7 +901,7 @@ export async function getConsumables(let query = client.from("consumables").select(CONSUMABLES_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1190,7 +1190,7 @@ export async function getItemPostingGroups(let query = client.from("itemPostingGroup").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1599,7 +1599,7 @@ export async function getMaterials(let query = client.from("materials").select(MATERIALS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1666,7 +1666,7 @@ export async function getMaterialDimensions(let query = client.from("materialDimensions").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("isMetric", args?.isMetric ?? false).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1723,7 +1723,7 @@ export async function getMaterialFinishes(let query = client.from("materialFinishes").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1774,7 +1774,7 @@ export async function getMaterialForms(let query = client.from("materialForm").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1817,7 +1817,7 @@ export async function getMaterialGrades(let query = client.from("materialGrades").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1876,7 +1876,7 @@ export async function getMaterialSubstances(let query = client.from("materialSubstance").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).or(`companyId.eq.${companyId},companyId.is.null`);@@ -1928,7 +1928,7 @@ export async function getMethodMaterials(.select("*, item(name, readableIdWithRevision), makeMethod!makeMethodId(item(id, type, name, readableIdWithRevision))",{- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1995,7 +1995,7 @@ export async function getMethodOperations(.select("*, makeMethod!makeMethodId(item(id, type, name, readableIdWithRevision))",{- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2286,7 +2286,7 @@ export async function getParts(.from("parts")// Later pages (`cursor`) skip the count: the first page already has it..select(PARTS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2479,7 +2479,7 @@ export async function getServices(let query = client.from("services").select(SERVICES_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2600,7 +2600,7 @@ export async function getTools(let query = client.from("tools").select(TOOLS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2678,7 +2678,7 @@ export async function getUnitOfMeasures(let query = client.from("unitOfMeasure").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -6245,7 +6245,7 @@ export async function getMaterialTypes() {let query = client.from("materialTypes")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).or(`companyId.eq.${companyId},companyId.is.null`);if (args?.search) {@@ -6919,7 +6919,7 @@ export async function getChangeNotices() {let query = client.from("changeOrders")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -7165,7 +7165,7 @@ export async function getChangeNoticeTypes() {let query = client.from("changeOrderType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -8520,7 +8520,7 @@ export async function getChangeNoticeRequiredActions() {let query = client.from("changeOrderRequiredAction")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {diff --git a/apps/erp/app/modules/people/people.service.ts b/apps/erp/app/modules/people/people.service.tsindex 6d9b19e76c..1e97c29aae 100644--- a/apps/erp/app/modules/people/people.service.ts+++ b/apps/erp/app/modules/people/people.service.ts@@ -13,7 +13,7 @@ import type { DataType } from "~/modules/shared";import type { Employee } from "~/modules/users";import { getEmployees } from "~/modules/users/users.service";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import type {departmentValidator,@@ -117,7 +117,7 @@ export async function getAttributeCategories(let query = client.from("userAttributeCategory").select("*, userAttribute(id, name, attributeDataType(id))", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("active", true)@@ -269,7 +269,7 @@ export async function getHolidays(let query = client.from("holiday").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -445,7 +445,7 @@ export async function getShifts(let query = client.from("shifts").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId).eq("active", true);@@ -1038,7 +1038,7 @@ export async function getTimecardEntries() {let query = client.from("timeCardEntries")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.tsindex af8a87420f..c17f1686a8 100644--- a/apps/erp/app/modules/production/production.service.ts+++ b/apps/erp/app/modules/production/production.service.ts@@ -58,6 +58,7 @@ import type { GenericQueryFilters, Paging } from "~/utils/query";import {getGenericFilter,LIST_COUNT,+ listCount,setGenericQueryFilters} from "~/utils/query";import { sanitize } from "~/utils/supabase";@@ -1277,7 +1278,7 @@ export async function getJobs(.from("jobs")// Later pages (`cursor`) skip the count: the first page already has it..select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1991,7 +1992,7 @@ export async function getJobOperations("*, jobMakeMethod(parentMaterialId, item(readableIdWithRevision))",{// Later pages (`cursor`) skip the count: the first page already has it.- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("jobId", jobId);@@ -2215,7 +2216,7 @@ export async function getProcedures(.from("procedures").select("*", {// Later pages (`cursor`) skip the count: the first page already has it.- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2282,7 +2283,7 @@ export async function getProductionEvents("*, jobOperation(description, jobMakeMethod(parentMaterialId, item(readableIdWithRevision)))",{// Later pages (`cursor`) skip the count: the first page already has it.- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).in("jobOperationId", jobOperationIds);@@ -2390,7 +2391,7 @@ export async function getProductionPlanning(},{// Later pages (`cursor`) skip the count: the first page already has it.- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)});@@ -2428,7 +2429,7 @@ export async function getProductionProjections(},{// Later pages (`cursor`) skip the count: the first page already has it.- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)});@@ -2471,7 +2472,7 @@ export async function getProductionQuantities("*, jobOperation(description, jobMakeMethod(parentMaterialId, item(readableIdWithRevision)))",{// Later pages (`cursor`) skip the count: the first page already has it.- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).in("jobOperationId", jobOperationIds);@@ -2556,7 +2557,7 @@ export async function getScrapReasons(.from("scrapReason")// Later pages (`cursor`) skip the count: the first page already has it..select("id, name, customFields", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -6706,7 +6707,7 @@ export async function getJobOperationBatches(.from("jobOperationBatch")// Later pages (`cursor`) skip the count: the first page already has it..select("*, process(name), workCenter(name)", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -6785,7 +6786,7 @@ export async function getUnattributedMachineTimes(.select("*, workCenter!inner(name, locationId, location(name, timezone))",{- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId),@@ -7387,7 +7388,7 @@ type AssemblyInstructionsScope = {function assemblyInstructionsQuery(client: SupabaseClient<Database>,args: AssemblyInstructionsScope,- count: typeof LIST_COUNT | undefined+ count: ReturnType<typeof listCount>) {let query = client// "assemblyInstructions" (plural) is the version-collapsing view: one row@@ -7443,11 +7444,7 @@ export async function getAssemblyInstructionsPage(client: SupabaseClient<Database>,args: AssemblyInstructionsScope & Partial<GenericQueryFilters>) {- let query = assemblyInstructionsQuery(- client,- args,- args.cursor ? undefined : LIST_COUNT- );+ let query = assemblyInstructionsQuery(client, args, listCount(args));query = setGenericQueryFilters(query, args, ASSEMBLY_INSTRUCTIONS_PAGING);return query;}diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.tsindex d445ee79b7..51853ecf1f 100644--- a/apps/erp/app/modules/purchasing/purchasing.service.ts+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts@@ -37,7 +37,7 @@ import type { z } from "zod";import { createDocumentUploadUrl } from "~/modules/documents/documents.service";import { getEmployeeJob } from "~/modules/people";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import {getCurrencyByCode,@@ -505,7 +505,7 @@ export async function getPurchaseOrders(.from("purchaseOrders")// Later pages (`cursor`) skip the count: the first page already has it..select(PURCHASE_ORDERS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -685,7 +685,7 @@ export async function getPurchasingPlanning(},{// Later pages (`cursor`) skip the count: the first page already has it.- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)});@@ -995,7 +995,7 @@ export async function getSupplierQuotes() {let query = client.from("supplierQuotes")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -1148,7 +1148,7 @@ export async function getSuppliers(let query = client.from("suppliers").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1208,7 +1208,7 @@ export async function getSupplierTypes() {let query = client.from("supplierType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -3183,7 +3183,7 @@ export async function getPurchasingRFQs() {let query = client.from("purchasingRfqs")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -3890,7 +3890,7 @@ export async function getPurchaseReturnOrders() {let query = client.from("purchaseReturnOrders")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -5321,7 +5321,7 @@ export async function getLeases() {let query = client.from("leases")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {diff --git a/apps/erp/app/modules/quality/quality.service.ts b/apps/erp/app/modules/quality/quality.service.tsindex 00428ea79b..5bf7f82101 100644--- a/apps/erp/app/modules/quality/quality.service.ts+++ b/apps/erp/app/modules/quality/quality.service.ts@@ -12,7 +12,7 @@ import { parseDate } from "@internationalized/date";import type { PostgrestError, SupabaseClient } from "@supabase/supabase-js";import type { z } from "zod";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";const logger = getLogger("erp", "quality");@@ -289,7 +289,7 @@ export async function getGauges() {let query = client.from("gauges")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -347,7 +347,7 @@ export async function getGaugeCalibrationRecords() {let query = client.from("gaugeCalibrationRecords")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -411,7 +411,7 @@ export async function getGaugeTypes() {let query = client.from("gaugeType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -449,7 +449,7 @@ export async function getIssues() {let query = client.from("issues")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1034,7 +1034,7 @@ export async function getIssueTypes() {let query = client.from("nonConformanceType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1060,7 +1060,7 @@ export async function getIssueWorkflows() {let query = client.from("nonConformanceWorkflow")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).eq("active", true);@@ -1112,7 +1112,7 @@ export async function getQualityActions() {let query = client.from("qualityActions")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1179,7 +1179,7 @@ export async function getQualityDocuments(let query = client.from("qualityDocuments").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1249,7 +1249,7 @@ export async function getRequiredActions() {let query = client.from("nonConformanceRequiredAction")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1302,7 +1302,7 @@ export async function getRisks(let query = client.from("riskRegisters").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2444,7 +2444,7 @@ export async function getInspections(.from("inspection").select("*, item(readableId, name), supplier(name), inspectionSample(status)",- { count: args?.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyId", companyId);@@ -2711,7 +2711,7 @@ export async function getInspectionDocuments() {let query = client.from("inspectionDocuments")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {diff --git a/apps/erp/app/modules/resources/resources.service.ts b/apps/erp/app/modules/resources/resources.service.tsindex 0b289d1f2a..5d0d8a5acc 100644--- a/apps/erp/app/modules/resources/resources.service.ts+++ b/apps/erp/app/modules/resources/resources.service.ts@@ -11,7 +11,7 @@ import {import type { SupabaseClient } from "@supabase/supabase-js";import type { z } from "zod";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import type {failureModeValidator,@@ -248,7 +248,7 @@ export async function getAbilities(// rather than embedded, so the read never depends on a view→table embed.let query = client.from("abilities")- .select(`*`, { count: args.cursor ? undefined : LIST_COUNT })+ .select(`*`, { count: listCount(args) }).eq("companyId", companyId).eq("active", true);@@ -375,7 +375,7 @@ export async function getContractors() {let query = client.from("contractors")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).eq("active", true);@@ -441,7 +441,7 @@ export async function getFailureModes() {let query = client.from("maintenanceFailureMode")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -487,7 +487,7 @@ export async function getLocations() {let query = client.from("location")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -634,7 +634,7 @@ export async function getMaintenanceDispatchesByLocation(p_company_id: companyId,p_location_id: locationId},- { count: args?.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) });if (args?.search) {@@ -736,7 +736,7 @@ export async function getMaintenanceSchedulesByLocation(p_company_id: companyId,p_location_id: locationId},- { count: args?.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) });if (args?.search) {@@ -886,7 +886,7 @@ export async function getProcesses() {let query = client.from("processes")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -933,7 +933,7 @@ export async function getSuggestions() {let query = client.from("suggestions")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1104,7 +1104,7 @@ export async function getTrainings(let query = client.from("trainings").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1179,7 +1179,7 @@ export async function getWorkCenters(let query = client.from("workCenters").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.tsindex 92aa0ad6e5..a90dd77e40 100644--- a/apps/erp/app/modules/sales/sales.service.ts+++ b/apps/erp/app/modules/sales/sales.service.ts@@ -34,7 +34,7 @@ import { createDocumentUploadUrl } from "~/modules/documents/documents.service";import { getSupplierPriceBreaksForItems } from "~/modules/items/items.service";import { getEmployeeJob } from "~/modules/people";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import { getCurrencyByCode, getExchangeRate } from "../accounting";import type {@@ -958,7 +958,7 @@ export async function getCustomers(let query = client.from("customers").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1008,7 +1008,7 @@ export async function getCustomerStatuses(let query = client.from("customerStatus").select("id, name, customFields", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1059,7 +1059,7 @@ export async function getCustomerTypes() {let query = client.from("customerType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1169,7 +1169,7 @@ export async function getNoQuoteReasons() {let query = client.from("noQuoteReason")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1305,7 +1305,7 @@ export async function getPricingRules() {let query = client.from("pricingRule")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -1350,7 +1350,7 @@ export async function getQuotes(let query = client.from("quotes").select(QUOTES_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -1877,7 +1877,7 @@ export async function getSalesOrders(.from("salesOrders")// Later pages (`cursor`) skip the count: the first page already has it..select(SALES_ORDERS_LIST_COLUMNS, {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -2109,7 +2109,7 @@ export async function getSalesRFQs() {let query = client.from("salesRfqs")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -2606,7 +2606,7 @@ export async function resolvePriceList(.from("item").select("id, readableId, name, thumbnailPath, itemUnitSalePrice(unitSalePrice), itemCost(itemPostingGroupId)",- { count: args.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("active", true).in("id", overriddenItemIds);@@ -2894,7 +2894,7 @@ export async function getBaseCatalog(.from("item").select("id, readableId, name, thumbnailPath, itemUnitSalePrice(unitSalePrice), itemCost(itemPostingGroupId)",- { count: args.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyId", companyId).eq("active", true);@@ -7095,7 +7095,7 @@ export async function getReturnReasons() {let query = client.from("returnReason")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -7191,7 +7191,7 @@ export async function getSalesReturnOrders() {let query = client.from("salesReturnOrders")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -8695,7 +8695,7 @@ export async function getRentalAgreements() {let query = client.from("rentalAgreements")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -9710,7 +9710,7 @@ export async function getContracts() {let query = client.from("customerContracts")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {diff --git a/apps/erp/app/modules/settings/settings.service.ts b/apps/erp/app/modules/settings/settings.service.tsindex 7cb693103f..27e86e47eb 100644--- a/apps/erp/app/modules/settings/settings.service.ts+++ b/apps/erp/app/modules/settings/settings.service.ts@@ -28,7 +28,7 @@ import type { SupabaseClient } from "@supabase/supabase-js";import type { z } from "zod";import type { plmReleaseControl as plmReleaseControlOptions } from "~/modules/items/items.models";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import { interpolateSequenceDate } from "~/utils/string";import { sanitize } from "~/utils/supabase";import type {@@ -132,7 +132,7 @@ export async function getApiKeys() {let query = client.from("apiKey")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {@@ -366,7 +366,7 @@ export async function getCustomFieldsTables(let query = client.from("customFieldTables").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -466,7 +466,7 @@ export async function getSequences(let query = client.from("sequence").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -507,7 +507,7 @@ export async function getItemSerialSequences(let query = client.from("itemSerialSequences").select("*", {- count: args.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);@@ -850,7 +850,7 @@ export async function getWebhooks(let query = client.from("webhook").select("*", {- count: args?.cursor ? undefined : LIST_COUNT+ count: listCount(args)}).eq("companyId", companyId);diff --git a/apps/erp/app/modules/shared/shared.service.ts b/apps/erp/app/modules/shared/shared.service.tsindex 79fd1070e6..94bf8694f3 100644--- a/apps/erp/app/modules/shared/shared.service.ts+++ b/apps/erp/app/modules/shared/shared.service.ts@@ -23,7 +23,7 @@ import type {SupabaseClient} from "@supabase/supabase-js";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import type {PriceBreak,SupplierPartPricing,@@ -317,7 +317,7 @@ export async function getCustomerPortals() {let query = client.from("externalLink")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).eq("documentType", "Customer");diff --git a/apps/erp/app/modules/users/users.service.ts b/apps/erp/app/modules/users/users.service.tsindex 4a35d00414..b61a9631cb 100644--- a/apps/erp/app/modules/users/users.service.ts+++ b/apps/erp/app/modules/users/users.service.ts@@ -8,7 +8,7 @@ import { getLogger } from "@carbon/logger";import { datetime } from "@carbon/utils";import type { PostgrestError, SupabaseClient } from "@supabase/supabase-js";import type { GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { LIST_COUNT, listCount, setGenericQueryFilters } from "~/utils/query";import type { UserSelectGroupMembers } from "./types";const logger = getLogger("erp", "users");@@ -265,7 +265,7 @@ export async function getEmployees() {let query = client.from("employees")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args.search) {@@ -308,7 +308,7 @@ export async function getConsoleOperators() {let query = client.from("employees")- .select("*", { count: args.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId).like("email", "%@console.internal");@@ -344,7 +344,7 @@ export async function getEmployeeTypes() {let query = client.from("employeeType")- .select("*", { count: args?.cursor ? undefined : LIST_COUNT })+ .select("*", { count: listCount(args) }).eq("companyId", companyId);if (args?.search) {diff --git a/apps/erp/app/modules/workflows/workflows.service.ts b/apps/erp/app/modules/workflows/workflows.service.tsindex 3a0249eb1d..561b94ca7e 100644--- a/apps/erp/app/modules/workflows/workflows.service.ts+++ b/apps/erp/app/modules/workflows/workflows.service.ts@@ -9,7 +9,7 @@ import { datetime } from "@carbon/utils";import type { SupabaseClient } from "@supabase/supabase-js";import type { z } from "zod";import type { Filter, GenericQueryFilters, Paging } from "~/utils/query";-import { LIST_COUNT, setGenericQueryFilters } from "~/utils/query";+import { listCount, setGenericQueryFilters } from "~/utils/query";import type { workflowValidator } from "./workflows.models";export const WORKFLOWS_PAGING: Paging = {@@ -25,7 +25,7 @@ export async function getWorkflows(.from("workflow").select("id, name, description, ownerId, publishedVersionId, createdAt, updatedAt",- { count: args?.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyId", companyId);@@ -312,7 +312,7 @@ export async function getWorkflowRuns("id, workflowId, workflowVersionId, eventId, sourceEventId, triggerTable, triggerRecordId, ownerId, status, statusReason, isTest, rootRunId, causedByRunId, depth, path, startedAt, completedAt, durationMs, error, createdAt, workflow(name)",// Estimated, not exact: this table grows with event volume, and `exact` is a// COUNT(*) over the company's whole retained history on every page load.- { count: args?.cursor ? undefined : LIST_COUNT }+ { count: listCount(args) }).eq("companyId", companyId);diff --git a/apps/erp/app/routes/x+/accounting+/projects.tsx b/apps/erp/app/routes/x+/accounting+/projects.tsxindex 58f649b002..709bb6077d 100644--- a/apps/erp/app/routes/x+/accounting+/projects.tsx+++ b/apps/erp/app/routes/x+/accounting+/projects.tsx@@ -55,6 +55,7 @@ export async function loader({ request }: LoaderFunctionArgs) {return {data: projects.rows,count: projects.count,+ exactCount: projects.exactCount,nextCursor: projects.nextCursor};}diff --git a/apps/erp/app/routes/x+/production+/batches.tsx b/apps/erp/app/routes/x+/production+/batches.tsxindex d9579c2e0c..4f8f2d6514 100644--- a/apps/erp/app/routes/x+/production+/batches.tsx+++ b/apps/erp/app/routes/x+/production+/batches.tsx@@ -58,6 +58,7 @@ export async function loader({ request }: LoaderFunctionArgs) {return {count: batches.count,+ exactCount: batches.exactCount,nextCursor: batches.nextCursor,batches: batches.rows.map((b) => ({...b,diff --git a/apps/erp/app/routes/x+/resources+/scheduled-maintenance.tsx b/apps/erp/app/routes/x+/resources+/scheduled-maintenance.tsxindex 096301e05e..93403bd22d 100644--- a/apps/erp/app/routes/x+/resources+/scheduled-maintenance.tsx+++ b/apps/erp/app/routes/x+/resources+/scheduled-maintenance.tsx@@ -87,6 +87,7 @@ export async function loader({ request }: LoaderFunctionArgs) {return {data: schedules.rows as MaintenanceSchedule[],count: schedules.count,+ exactCount: schedules.exactCount,nextCursor: schedules.nextCursor,locations: locationsList,locationId: selectedLocationIddiff --git a/apps/erp/app/routes/x+/workflows+/runs.tsx b/apps/erp/app/routes/x+/workflows+/runs.tsxindex 75c523303c..082bd09f3b 100644--- a/apps/erp/app/routes/x+/workflows+/runs.tsx+++ b/apps/erp/app/routes/x+/workflows+/runs.tsx@@ -64,6 +64,7 @@ export async function loader({ request }: LoaderFunctionArgs) {recordName: recordNames[`${run.triggerTable}:${run.triggerRecordId}`]})),count: runs.count,+ exactCount: runs.exactCount,nextCursor: runs.nextCursor};}diff --git a/apps/erp/app/utils/list-registry/accounting.server.ts b/apps/erp/app/utils/list-registry/accounting.server.tsindex e0bc70b8ac..5b775448b0 100644--- a/apps/erp/app/utils/list-registry/accounting.server.ts+++ b/apps/erp/app/utils/list-registry/accounting.server.ts@@ -85,11 +85,12 @@ export const dimensionsList = {context);if (!companyGroupId) return { data: null, error };- const { params, limit, cursor, sorts, filters } = context;+ const { params, limit, cursor, exactCount, sorts, filters } = context;return getDimensions(client, companyGroupId, {search: params.get("search"),limit,cursor,+ exactCount,sorts,filters});@@ -107,11 +108,12 @@ export const intercompanyTransactionsList = {context);if (!companyGroupId) return { data: null, error };- const { params, limit, cursor, sorts, filters } = context;+ const { params, limit, cursor, exactCount, sorts, filters } = context;return getIntercompanyTransactions(client, companyGroupId, {status: params.get("status"),limit,cursor,+ exactCount,sorts,filters});@@ -139,13 +141,14 @@ function periodRunsQuery(type: RunType) {...[client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }]: Parameters<ListDefinition["query"]>) =>getRevenueRecognitionRuns(client, companyId, type, {search: params.get("search"),limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/list-registry/documents.server.ts b/apps/erp/app/utils/list-registry/documents.server.tsindex c575757d94..8e5adefbd9 100644--- a/apps/erp/app/utils/list-registry/documents.server.ts+++ b/apps/erp/app/utils/list-registry/documents.server.ts@@ -18,7 +18,7 @@ function documentsQuery(recent: boolean) {...[client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }]: Parameters<ListDefinition["query"]>) => {const filter = params.get("q");@@ -29,6 +29,7 @@ function documentsQuery(recent: boolean) {active: filter !== "trash",limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/list-registry/index.server.ts b/apps/erp/app/utils/list-registry/index.server.tsindex 4f7cb99e7e..d9983c90f4 100644--- a/apps/erp/app/utils/list-registry/index.server.ts+++ b/apps/erp/app/utils/list-registry/index.server.ts@@ -6,8 +6,7 @@ import type { requirePermissions } from "@carbon/auth/auth.server";import type { Database } from "@carbon/database";import type { SupabaseClient } from "@supabase/supabase-js";import type { Cursor, Paging } from "../cursor";-import { decodeCursor, toPage } from "../cursor";-import { PAGE_SIZE } from "../pagination";+import { toPage } from "../cursor";import type { Filter, Sort } from "../query";import { getGenericQueryFilters } from "../query";import { accountingLists } from "./accounting.server";@@ -34,8 +33,16 @@ import { workflowsLists } from "./workflows.server";* module batches can add entries without touching the same file.*/-/** Which page to read: `limit` rows after `cursor` (null: the first page). */-export type ListPaging = { limit: number; cursor: Cursor | null };+/**+ * Which page to read: `limit` rows after `cursor` (null: the first page).+ * `exactCount` is the Table's count request (`?count=exact`): an exact count+ * and no rows to show.+ */+export type ListPaging = {+ limit: number;+ cursor: Cursor | null;+ exactCount?: boolean;+};export type ListPermission = Omit<Parameters<typeof requirePermissions>[1],@@ -99,6 +106,8 @@ export type ListPage<TRow> = {rows: TRow[];/** The number of matching rows. Only the first page counts (0 later). */count: number;+ /** Set when `count` is exact: the page was the Table's count request. */+ exactCount?: true;nextCursor: string | null;error: unknown;};@@ -127,7 +136,8 @@ export function getListDefinition(key: string): ListDefinition | undefined {/*** Runs a list's query for one page and cuts it with `toPage`. Without- * `paging`, the page is the one the URL asks for: 100 rows after `?after=`.+ * `paging`, the page is the one the URL asks for: 100 rows after `?after=`,+ * or the exact count for `?count=exact`.* `options.companyGroupId` saves a group lookup for group-scoped lists.*/export async function fetchListPage<TRow extends Record<string, unknown>>(@@ -135,15 +145,18 @@ export async function fetchListPage<TRow extends Record<string, unknown>>(client: SupabaseClient<Database>,companyId: string,params: URLSearchParams,- paging: ListPaging = {- limit: PAGE_SIZE,- cursor: decodeCursor(params.get("after"))- },+ paging?: ListPaging,options: { companyGroupId?: string } = {}): Promise<ListPage<TRow>> {- const { sorts = [], filters = [] } = getGenericQueryFilters(params);+ const {+ limit,+ cursor = null,+ exactCount,+ sorts = [],+ filters = []+ } = getGenericQueryFilters(params);const result = await definition.query(client, companyId, {- ...paging,+ ...(paging ?? { limit, cursor, exactCount }),params,sorts,filters,@@ -151,13 +164,14 @@ export async function fetchListPage<TRow extends Record<string, unknown>>(});const page = toPage(result.data ?? [],- { limit: paging.limit, sorts },+ { limit: paging?.limit ?? limit, sorts },definition);return {rows: page.rows,count: result.count ?? 0,nextCursor: page.nextCursor,+ ...(!paging && exactCount ? { exactCount: true as const } : {}),error: result.error};}@@ -231,7 +245,11 @@ export function searchList<TRow extends Record<string, unknown>, TArgs>({permission,...paging,...(exportRows ? { exportRows } : {}),- query: (client, companyId, { params, limit, cursor, sorts, filters }) => {+ query: (+ client,+ companyId,+ { params, limit, cursor, exactCount, sorts, filters }+ ) => {const named: Record<string, unknown> = { search: params.get("search") };for (const [arg, reader] of Object.entries(readers)) {named[arg] =@@ -241,6 +259,7 @@ export function searchList<TRow extends Record<string, unknown>, TArgs>({...named,limit,cursor,+ exactCount,sorts,filters} as TArgs);diff --git a/apps/erp/app/utils/list-registry/invoicing.server.ts b/apps/erp/app/utils/list-registry/invoicing.server.tsindex b2b2350f6a..7d848be468 100644--- a/apps/erp/app/utils/list-registry/invoicing.server.ts+++ b/apps/erp/app/utils/list-registry/invoicing.server.ts@@ -57,7 +57,11 @@ export const paymentsList = {key: "payments",permission: { view: "invoicing" },...PAYMENTS_PAGING,- query: (client, companyId, { params, limit, cursor, sorts, filters }) => {+ query: (+ client,+ companyId,+ { params, limit, cursor, exactCount, sorts, filters }+ ) => {const split = splitCounterpartyFilter(filters);return getPayments(client, companyId, {search: params.get("search"),@@ -71,6 +75,7 @@ export const paymentsList = {counterpartyIds: split.counterpartyIds,limit,cursor,+ exactCount,sorts,filters: split.filters});@@ -84,7 +89,7 @@ function memosQuery(party: "customer" | "supplier") {...[client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }]: Parameters<ListDefinition["query"]>) => {const split = splitCounterpartyFilter(filters);@@ -96,6 +101,7 @@ function memosQuery(party: "customer" | "supplier") {counterpartyIds: split.counterpartyIds,limit,cursor,+ exactCount,sorts,filters: split.filters});diff --git a/apps/erp/app/utils/list-registry/items.server.ts b/apps/erp/app/utils/list-registry/items.server.tsindex b8b28759b3..2a0f490dca 100644--- a/apps/erp/app/utils/list-registry/items.server.ts+++ b/apps/erp/app/utils/list-registry/items.server.ts@@ -113,7 +113,7 @@ export const materialDimensionsList = {query: async (client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }) => {const settings = await getCompanySettings(client, companyId);return getMaterialDimensions(client, companyId, {@@ -121,6 +121,7 @@ export const materialDimensionsList = {isMetric: settings?.data?.useMetric ?? false,limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/list-registry/load.server.ts b/apps/erp/app/utils/list-registry/load.server.tsindex caf2b18d76..c94d377af5 100644--- a/apps/erp/app/utils/list-registry/load.server.ts+++ b/apps/erp/app/utils/list-registry/load.server.ts@@ -124,6 +124,11 @@ export async function loadListPage<);const requestParams = new URL(request.url).searchParams;const after = requestParams.get("after");+ // The Table's count request: the exact count only, after page 1 shows.+ const countOnly = requestParams.get("count") === "exact";+ // A request a fetcher reads (a later page or the count): an error must not+ // throw, or the route's error screen replaces the list.+ const fromFetcher = Boolean(after) || countOnly;const context: ListLoaderContext = {...auth,request,@@ -142,7 +147,7 @@ export async function loadListPage<undefined,{ companyGroupId: auth.companyGroupId }),- after ? undefined : options.firstPage?.(context)+ fromFetcher ? undefined : options.firstPage?.(context)]);if (page.error) {@@ -150,9 +155,10 @@ export async function loadListPage<listKey: list.key,companyId: auth.companyId,laterPage: Boolean(after),+ countOnly,error: page.error});- if (after) return listErrorPage(options.dataKey);+ if (fromFetcher) return listErrorPage(options.dataKey);if (options.onError) {throw redirect(options.onError.redirectTo,@@ -161,6 +167,15 @@ export async function loadListPage<}}+ if (countOnly) {+ return {+ [options.dataKey]: [],+ count: page.count,+ exactCount: page.exactCount,+ nextCursor: null+ } as unknown as ListLoaderData<TKey, TOut> & TExtra;+ }+const rows =options.mapRows && !page.error? await options.mapRows(page.rows, context)@@ -174,11 +189,12 @@ export async function loadListPage<} as ListLoaderData<TKey, TOut> & TExtra;};- if (!after) return loadPage();- // A later page is read by the Table's fetcher, and a fetcher whose loader- // throws replaces the whole list with the route's error screen. So any- // error becomes `listError` ("Couldn't load more rows" with Retry). A thrown- // Response (a redirect, a refusal) is the router's to handle.+ if (!fromFetcher) return loadPage();+ // A later page or the count is read by the Table's fetcher, and a fetcher+ // whose loader throws replaces the whole list with the route's error screen.+ // So any error becomes `listError` ("Couldn't load more rows" with Retry; a+ // failed count keeps the estimate). A thrown Response (a redirect, a+ // refusal) is the router's to handle.try {return await loadPage();} catch (thrown) {@@ -186,7 +202,8 @@ export async function loadListPage<logger.error("Failed to load a page of the list {listKey}", {listKey: list.key,companyId: auth.companyId,- laterPage: true,+ laterPage: Boolean(after),+ countOnly,error: thrown});return listErrorPage(options.dataKey);diff --git a/apps/erp/app/utils/list-registry/production.server.ts b/apps/erp/app/utils/list-registry/production.server.tsindex 2f626e69c8..37c3da4644 100644--- a/apps/erp/app/utils/list-registry/production.server.ts+++ b/apps/erp/app/utils/list-registry/production.server.ts@@ -108,12 +108,17 @@ export const assemblyInstructionsList = {key: "assembly-instructions",permission: { view: "production", role: "employee" },...ASSEMBLY_INSTRUCTIONS_PAGING,- query: (client, companyId, { params, limit, cursor, sorts, filters }) =>+ query: (+ client,+ companyId,+ { params, limit, cursor, exactCount, sorts, filters }+ ) =>getAssemblyInstructionsPage(client, {companyId,search: params.get("search") ?? undefined,limit,cursor,+ exactCount,sorts,filters})diff --git a/apps/erp/app/utils/list-registry/purchasing.server.ts b/apps/erp/app/utils/list-registry/purchasing.server.tsindex 16ac626e30..b8b01c7494 100644--- a/apps/erp/app/utils/list-registry/purchasing.server.ts+++ b/apps/erp/app/utils/list-registry/purchasing.server.ts@@ -65,11 +65,12 @@ export const supplierTypesList = {permission: { view: "purchasing", role: "employee" },...SUPPLIER_TYPES_PAGING,// The list has no column filters: the loader never passed them.- query: (client, companyId, { params, limit, cursor, sorts }) =>+ query: (client, companyId, { params, limit, cursor, exactCount, sorts }) =>getSupplierTypes(client, companyId, {search: params.get("search"),limit,cursor,+ exactCount,sorts})} satisfies ListDefinition;diff --git a/apps/erp/app/utils/list-registry/resources.server.ts b/apps/erp/app/utils/list-registry/resources.server.tsindex 4bb7d0eaa3..a9af49fd77 100644--- a/apps/erp/app/utils/list-registry/resources.server.ts+++ b/apps/erp/app/utils/list-registry/resources.server.ts@@ -73,7 +73,7 @@ export const maintenanceDispatchesList = {query: async (client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }) => {const locationId = await resolveMaintenanceLocationId(client,@@ -86,6 +86,7 @@ export const maintenanceDispatchesList = {status: params.get("status") ?? undefined,limit,cursor,+ exactCount,sorts,filters});@@ -99,7 +100,7 @@ export const maintenanceSchedulesList = {query: async (client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }) => {const locationId = await resolveMaintenanceLocationId(client,@@ -111,6 +112,7 @@ export const maintenanceSchedulesList = {search: params.get("search"),limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/list-registry/sales.server.ts b/apps/erp/app/utils/list-registry/sales.server.tsindex 3537aa851c..529fc2cf64 100644--- a/apps/erp/app/utils/list-registry/sales.server.ts+++ b/apps/erp/app/utils/list-registry/sales.server.ts@@ -95,7 +95,7 @@ export const priceListList = {query: async (client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }) => {const search = params.get("search") ?? undefined;const customerId = params.get("customerId") ?? undefined;@@ -113,6 +113,7 @@ export const priceListList = {search,limit,cursor,+ exactCount,sorts,filters})@@ -120,6 +121,7 @@ export const priceListList = {search,limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/list-registry/settings.server.ts b/apps/erp/app/utils/list-registry/settings.server.tsindex ee64d5f41b..22f49f67d4 100644--- a/apps/erp/app/utils/list-registry/settings.server.ts+++ b/apps/erp/app/utils/list-registry/settings.server.ts@@ -25,12 +25,13 @@ export const apiKeysList = {query: async (client,companyId,- { params, limit, cursor, sorts, filters }+ { params, limit, cursor, exactCount, sorts, filters }) => {const result = await getApiKeys(client, companyId, {search: params.get("search"),limit,cursor,+ exactCount,sorts,filters});diff --git a/apps/erp/app/utils/query.test.ts b/apps/erp/app/utils/query.test.tsindex d4a51b5b5d..3591ae34c7 100644--- a/apps/erp/app/utils/query.test.ts+++ b/apps/erp/app/utils/query.test.ts@@ -21,6 +21,8 @@ const {getGenericFilter,getGenericQueryFilters,getSearchTokens,+ LIST_COUNT,+ listCount,parseRangeFilter,setGenericQueryFilters,setSearchFilter@@ -161,6 +163,35 @@ describe("cursor paging params", () => {getGenericQueryFilters(new URLSearchParams({ after: "garbage" })).cursor).toBeNull();});++ it("reads the Table's count request from ?count=exact, without a cursor", () => {+ const cursor = { values: ["Bolt"], id: "it_1", keys: ["name:asc"] };+ const params = new URLSearchParams({+ after: encodeCursor(cursor),+ count: "exact"+ });+ expect(getGenericQueryFilters(params)).toMatchObject({+ cursor: null,+ exactCount: true+ });+ expect(getGenericQueryFilters(new URLSearchParams())).not.toHaveProperty(+ "exactCount"+ );+ });+});++describe("listCount", () => {+ it("counts page 1 with LIST_COUNT, a later page not at all", () => {+ expect(listCount({ cursor: null })).toBe(LIST_COUNT);+ expect(listCount(undefined)).toBe(LIST_COUNT);+ expect(+ listCount({ cursor: { values: [], id: "a", keys: [] } })+ ).toBeUndefined();+ });++ it("counts exactly for the count request", () => {+ expect(listCount({ cursor: null, exactCount: true })).toBe("exact");+ });});describe("getEffectiveSorts", () => {@@ -209,6 +240,16 @@ describe("setGenericQueryFilters paging", () => {expect(query.range).not.toHaveBeenCalled();});+ it("asks for one row for the count request", () => {+ const query = createQueryStub();+ setGenericQueryFilters(+ query as never,+ { limit: 100, cursor: null, exactCount: true },+ sorts+ );+ expect(query.limit).toHaveBeenCalledWith(1);+ });+it("keeps exact offset paging when no cursor is given (MCP, v1 API)", () => {const query = createQueryStub();setGenericQueryFilters(query as never, { limit: 50, offset: 100 }, sorts);diff --git a/apps/erp/app/utils/query.ts b/apps/erp/app/utils/query.tsindex e7f5419e3a..af92e7bd79 100644--- a/apps/erp/app/utils/query.ts+++ b/apps/erp/app/utils/query.ts@@ -45,6 +45,17 @@ type GenericSchema = {*/export const LIST_COUNT = "estimated" as const;+/**+ * The count mode of a list query: none on a later page, `exact` for the+ * Table's count request (`?count=exact`), else `LIST_COUNT`.+ */+export function listCount(+ args?: Pick<GenericQueryFilters, "cursor" | "exactCount">+) {+ if (args?.exactCount) return "exact" as const;+ return args?.cursor ? undefined : LIST_COUNT;+}+export type Filter = {column: string;operator: string;@@ -64,6 +75,11 @@ export interface GenericQueryFilters {* (`scripts/lib/service-metadata.ts`). Used only when `cursor` is absent.*/offset?: number;+ /**+ * The Table's count request (`?count=exact`): an exact count and one row.+ * `LIST_COUNT` is an estimate from 1,000 rows up.+ */+ exactCount?: boolean;sorts?: Sort[];filters?: Filter[];}@@ -72,7 +88,8 @@ export function getGenericQueryFilters(params: URLSearchParams): GenericQueryFilters {const limit = PAGE_SIZE;- const cursor = decodeCursor(params.get("after"));+ const exactCount = params.get("count") === "exact";+ const cursor = exactCount ? null : decodeCursor(params.get("after"));const sortParams = params.getAll("sort");const sorts: Sort[] =@@ -103,7 +120,13 @@ export function getGenericQueryFilters(.filter((filter) => filter !== undefined) as Filter[]): [];- return { limit, cursor, sorts, filters };+ return {+ limit,+ cursor,+ sorts,+ filters,+ ...(exactCount ? { exactCount } : {})+ };}/**@@ -246,8 +269,10 @@ export function setGenericQueryFilters<if (args.cursor !== undefined) {// Cursor paging (list loaders). One extra row tells `toPage` that a next- // page exists.- if (typeof args.limit === "number") {+ // page exists. A count request needs no rows.+ if (args.exactCount) {+ query = query.limit(1);+ } else if (typeof args.limit === "number") {query = query.limit(args.limit + 1);}} else if (Number.isInteger(args.offset) && Number.isInteger(args.limit)) {diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex e16c127ca3..3ae782a1fc 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# Zeile} other {# Zeilen}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {etwa # Zeile} other {etwa # Zeilen}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {# passende Zeile ausgewählt} other {Alle # passenden Zeilen ausgewählt}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {# Los auflösen} other {# Lose auflösen}}"diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex fd8df97371..8d59f6587a 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# row} other {# rows}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {about # row} other {about # rows}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex 4063820c54..6f1aad5e04 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# fila} other {# filas}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {aprox. # fila} other {aprox. # filas}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {# fila coincidente seleccionada} other {Las # filas coincidentes seleccionadas}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Disolver # lote de producción} other {Disolver # lotes de producción}}"diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex 89b706d765..b10e6f7f2b 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# ligne} other {# lignes}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {environ # ligne} other {environ # lignes}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {# ligne correspondante sélectionnée} other {Les # lignes correspondantes sont sélectionnées}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Dissoudre # lot de production} other {Dissoudre # lots de production}}"diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex 1d32e94c93..98c92823c7 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# पंक्ति} other {# पंक्तिmsgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {लगभग # पंक्ति} other {लगभग # पंक्तियाँ}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {मिलती हुई # पंक्ति चुनी गई} other {मिलती हुई सभी # पंक्तियाँ चुनी गईं}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {# बैच विघटित करें} other {# बैच विघटित करें}}"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex 4ea53f58f6..b9a7d0b173 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# riga} other {# righe}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {circa # riga} other {circa # righe}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {# riga corrispondente selezionata} other {Tutte le # righe corrispondenti selezionate}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Sciogli # lotto di produzione} other {Sciogli # lotti di produzione}}"diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex 4256a13ed9..42a1b55fb9 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# 行} other {# 行}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {約# 行} other {約# 行}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {一致する#行をすべて選択しました} other {一致する#行をすべて選択しました}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {# バッチを解散} other {# バッチを解散}}"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex ef239c14a2..6e754ce509 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {#행} other {#행}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {약 #행} other {약 #행}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {일치하는 #행 모두 선택됨} other {일치하는 #행 모두 선택됨}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {배치 # 해제} other {배치 # 해제}}"diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex 45392438ab..7864486e5b 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# wiersz} few {# wiersze} many {# wierszy} other {#msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {około # wiersz} few {około # wiersze} many {około # wierszy} other {około # wierszy}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {Zaznaczono # pasujący wiersz} few {Zaznaczono wszystkie # pasujące wiersze} many {Zaznaczono wszystkie # pasujących wierszy} other {Zaznaczono wszystkie # pasującego wiersza}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Rozpuść # partię produkcyjną} few {Rozpuść # partie produkcyjne} many {Rozpuść # partii produkcyjnych} other {Rozpuść # partii produkcyjnych}}"diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex 06ba29d1a1..d555f5069e 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# linha} other {# linhas}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {cerca de # linha} other {cerca de # linhas}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {# linha correspondente selecionada} other {Todas as # linhas correspondentes selecionadas}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Dissolver # lote de produção} other {Dissolver # lotes de produção}}"diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex 0000c147f1..6f805a6176 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# строка} few {# строки} many {# стрmsgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {около # строки} few {около # строк} many {около # строк} other {около # строк}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {Выбрана # подходящая строка} few {Выбраны все # подходящие строки} many {Выбраны все # подходящих строк} other {Выбраны все # подходящей строки}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {Расформировать # серию} few {Расформировать # серии} many {Расформировать # серий} other {Расформировать # серий}}"diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex 2f39180698..cc73c62acc 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# satır} other {# satır}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {yaklaşık # satır} other {yaklaşık # satır}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {Eşleşen # satır seçildi} other {Eşleşen # satırın tümü seçildi}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {# partiyi çöz} other {# partileri çöz}}"diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex b0f07158a4..dce873dc8b 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -480,6 +480,9 @@ msgstr "{count, plural, one {# 行} other {# 行}}"msgid "{count, plural, one {about # row} other {about # rows}}"msgstr "{count, plural, one {约 # 行} other {约 # 行}}"+msgid "{count, plural, one {All # matching row selected} other {All # matching rows selected}}"+msgstr "{count, plural, one {已选择全部 # 行匹配项} other {已选择全部 # 行匹配项}}"+msgid "{count, plural, one {Dissolve # batch} other {Dissolve # batches}}"msgstr "{count, plural, one {关闭 # 生产批次} other {关闭 # 生产批次}}"