diff --git a/docs/development/PERFORMANCE_BASELINE.md b/docs/development/PERFORMANCE_BASELINE.md index a0916d6b..392f3ab8 100644 --- a/docs/development/PERFORMANCE_BASELINE.md +++ b/docs/development/PERFORMANCE_BASELINE.md @@ -32,7 +32,10 @@ Current Hosts also filter individual rolls by status, ownership, material, vendor, location and low-stock policy before grouping. Opening the filter panel requests distinct materials and vendors from the whole stock in the same read transaction. Older Hosts and offline Clients filter the complete live or saved -list. List view, labels and selection use the complete stock so they cover every matching roll. +list. Opening and closing Add spool keeps the loaded cards and reads the +registration catalog on demand. A successful registration refreshes stock +so the new roll can be opened. List view, labels and selection use the +complete stock so they cover every matching roll. A Client without a complete offline capture obtains one on its first full read. Older Hosts and disconnected Clients use the existing full-list or scoped offline path. Reading a card page preserves the last complete capture and its diff --git a/scripts/run-loan-dialog-regressions.mjs b/scripts/run-loan-dialog-regressions.mjs index 95c12bcc..b559f714 100644 --- a/scripts/run-loan-dialog-regressions.mjs +++ b/scripts/run-loan-dialog-regressions.mjs @@ -195,6 +195,7 @@ async function checkStockCards({page, state, fixture, calls, fallback, openWorks state.invoke = (command,payload) => { switch (command) { case "get_library_sync_page_status": return status; + case "fetch_library_sync_catalog_masters": return fixture.catalogRows; case "get_loan_workspace_counts": return {stock:10, locations:0, loans:2, purchases:0}; case "fetch_library_sync_loans": case "fetch_library_sync_active_loans": return fixture.loanRows; @@ -253,6 +254,13 @@ async function checkStockCards({page, state, fixture, calls, fallback, openWorks await panel.getByRole("button",{name:"Show more",exact:true}).click(); await panel.getByRole("heading",{name:/Dialog b/}).waitFor(); assert.deepEqual(reads,[0,3,1,0,1]); + const readsBeforeRegistration = reads.length; + await page.getByRole("button", {name: "Add spool", exact: true}).click(); + const registration = page.getByRole("dialog"); + await registration.getByRole("button", {name: "Close", exact: true}).click(); + await registration.waitFor({state: "detached"}); + await panel.getByRole("heading", {name: /Dialog b/}).waitFor(); + assert.equal(reads.length, readsBeforeRegistration, "Closing registration must retain the loaded card pages"); assert.ok(!calls.some(c=>c.command==="fetch_library_sync_spool_snapshot")); const searchBox = page.getByPlaceholder(/Search by material/i); calls.length = 0; diff --git a/ui/src/pages/inventory.tsx b/ui/src/pages/inventory.tsx index f9c4b915..5e11d82c 100644 --- a/ui/src/pages/inventory.tsx +++ b/ui/src/pages/inventory.tsx @@ -402,7 +402,7 @@ export default function InventoryPage({ setRequiresFullStock(false); setPendingStockAction(null); }, [activeWorkspaceView, locationAuthorityKey]); - const requestCards = !requiresFullStock && inventoryView === "CARDS" && !navigationIntent && !addModalActive && !showRollModal && + const requestCards = !requiresFullStock && inventoryView === "CARDS" && !navigationIntent && !showRollModal && !recentlyAddedSpoolId && !detailVisualFixture; const requestCardsRef = useRef(requestCards); useEffect(() => { requestCardsRef.current = requestCards; }, [requestCards]);