Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/development/PERFORMANCE_BASELINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ offline path. Reading a card page preserves the last complete capture and its
timestamp. An explicit refresh of Stock on a paired Client renews that complete
offline inventory.

List view filters individual rolls in inventory order. Product grouping and sorting
run when the card view needs them.

The 10,000-spool contract renders at most 200 list rows or 96 card groups at
once. Complete pagination is separately covered by
`ui/src/lib/spool_data_source.test.ts`, including the 10,000-row case with
Expand Down
19 changes: 19 additions & 0 deletions ui/src/components/inventory_balanced_workspace.browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,26 @@ test("balanced inventory preserves per-roll weights, filtering, selection and co
await page.getByRole("button",{name:"Done selecting",exact:true}).click();
await page.getByRole("button",{name:"List view",exact:true}).click();assert.equal(await page.locator(".inventory-list-row").count(),12);
await page.screenshot({path:resolve(out,"en-1440-dark-liste.png"),fullPage:true});
const groupCount = page.locator("output[data-product-groups]");
assert.equal(await groupCount.getAttribute("data-product-groups"), "0");
const search = page.getByRole("searchbox");
await search.fill("ABS Black");
const listRefs = page.locator(".inventory-list-reference");
await page.waitForFunction(() => document.querySelectorAll(".inventory-list-reference").length === 3);
const filteredOrder = await listRefs.allTextContents();
assert.deepEqual(filteredOrder, ["#a44954", "#3fc0da", "#248216"]);
assert.equal(await groupCount.getAttribute("data-product-groups"), "0");
await page.getByRole("button", {name:"Card view", exact:true}).click();
assert.equal(await cards.count(), 2);
assert.equal(await groupCount.getAttribute("data-product-groups"), "2");
assert.equal(await black.locator(".inventory-roll-row").count(), 2);
await page.getByRole("button", {name:"List view", exact:true}).click();
assert.deepEqual(await listRefs.allTextContents(), filteredOrder);
assert.equal(await groupCount.getAttribute("data-product-groups"), "0");
await search.fill("");
await page.waitForFunction(() => document.querySelectorAll(".inventory-list-reference").length === 12);
await page.getByRole("button",{name:"Card view",exact:true}).click();
assert.equal(await cards.count(), 10);
const menu=black.locator(".inventory-product-menu");assert.equal(await menu.locator("button").count(),0);await menu.locator("summary").press("Enter");await menu.getByRole("button").first().press("Enter");await page.waitForFunction(()=>document.querySelector("output")?.getAttribute("data-selected-roll")==="spool_a44954");
}
await page.locator("#inventory-loans-tab").click();await page.locator(".inventory-loan-table").waitFor();
Expand Down
4 changes: 2 additions & 2 deletions ui/src/lib/use_inventory_filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export function useInventoryFilters(
],
);
const groupedSpools = useMemo<SpoolGroup[]>(
() => groupInventorySpools(filteredSpools),
[filteredSpools],
() => inventoryView === "CARDS" ? groupInventorySpools(filteredSpools) : [],
[filteredSpools, inventoryView],
);
const otherFilterCount = [
statusFilter !== "ALL",
Expand Down
2 changes: 1 addition & 1 deletion ui/test-fixtures/inventory_balanced_workspace_entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Preview({theme}:{theme:ThemeMode}) {
<InventorySpoolCollection addSpoolDisabled={false} bulkSelectionActive={bulk} bulkSelectionDisabled={false} filteredSpools={f.filteredSpools} groupedSpools={f.groupedSpools} inventoryView={f.inventoryView} loading={false} onAddSpool={()=>{}} onBulkSelectionChange={(id,checked)=>setSelected(old=>{const next=new Set(old);if(checked)next.add(id);else next.delete(id);return next;})} onResetFilters={f.resetFilters} onSelectRoll={setRoll} recentlyAddedSpoolId={null} resolvedTheme={theme==="light"?"light":"dark"} selectedSpoolId={roll} selectedBulkSpoolIds={selected} totalSpoolCount={59}/></>:view==="LOANS"?<section style={{marginTop:24}}><div className="inventory-loan-summary"><span>{t("loans.history","Loan history")}</span><span>5</span></div><LoanHistoryTable loans={loans} busy={false} onReturn={setReturnLoan}/></section>:<p>{view}</p>}
</>}
<LoanReturnModal busy={false} error={null} loan={returnLoan} grams={grams} note={note} onClose={()=>setReturnLoan(null)} onConfirm={()=>Object.assign(window,{returnConfirmed:true})} onGramsChange={setGrams} onNoteChange={setNote}/>
<output className="sr-only" data-selection={selected.size} data-selected-roll={roll}/>
<output className="sr-only" data-product-groups={f.groupedSpools.length} data-selection={selected.size} data-selected-roll={roll}/>
</main></>;
}
export async function mountInventoryWorkspacePreview(locale:Locale="nb",theme:ThemeMode="dark") {
Expand Down
Loading