From 4dfbabe49692f67b4fade68f76b76cba8cd7faa7 Mon Sep 17 00:00:00 2001 From: Syogo-Suganoya <55225064+Syogo-Suganoya@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:19:30 +0900 Subject: [PATCH] [bug] Fix navigation when clicking a BOM row (#13345) * Allow navigating to a sub-part by clicking a BOM row Clicking a row in the BOM table no longer did anything, as the cell click handler was disabled entirely. Only disable it while the BOM is being edited. Co-Authored-By: Claude Opus 5.5 * Add regression test for nested BOM row expansion and navigation Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- src/frontend/src/tables/bom/BomTable.tsx | 3 +- src/frontend/tests/pages/pui_part.spec.ts | 56 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/tables/bom/BomTable.tsx b/src/frontend/src/tables/bom/BomTable.tsx index 106be21064..d29a7fa586 100644 --- a/src/frontend/src/tables/bom/BomTable.tsx +++ b/src/frontend/src/tables/bom/BomTable.tsx @@ -878,7 +878,8 @@ export function BomTable({ tableFilters: tableFilters, modelType: ModelType.part, modelField: 'sub_part', - onCellClick: () => {}, + // Navigate to the sub-part when a row is clicked (except while editing) + onCellClick: isEditing ? () => {} : undefined, rowActions: isEditing ? rowActions : undefined, enableSelection: isEditing && !isLocked, enableBulkDelete: diff --git a/src/frontend/tests/pages/pui_part.spec.ts b/src/frontend/tests/pages/pui_part.spec.ts index 99f0a20437..aa163ccd6c 100644 --- a/src/frontend/tests/pages/pui_part.spec.ts +++ b/src/frontend/tests/pages/pui_part.spec.ts @@ -414,6 +414,62 @@ test('Parts - BOM Nesting', async ({ browser }) => { ).toHaveCount(0); }); +/** + * Clicking a BOM row opens the sub-part (but not while editing the BOM) + */ +test('Parts - BOM Navigation', async ({ browser }) => { + const page = await doCachedLogin(browser, { url: 'part/104/bom' }); + + const cell = page.getByText('Blue Paint', { exact: true }).first(); + const details = page.getByRole('link', { name: 'details-part-89' }); + + // While editing, clicking a row does not open the sub-part + await page.getByRole('button', { name: 'action-button-edit-bom' }).click(); + await page + .getByRole('button', { name: 'action-button-finish-editing-' }) + .waitFor(); + await cell.click(); + await page.waitForTimeout(500); + await expect(details).toHaveCount(0); + await expect(page).toHaveURL(/part\/104\/bom/); + + // Otherwise, clicking a row opens the sub-part + // (either directly, or via the preview drawer, depending on user settings) + await navigate(page, 'part/104/bom'); + await cell.click(); + await page.getByText('Part: Blue Paint').or(details).first().waitFor(); + + // Sub-assembly rows can still be expanded and collapsed, + // without opening the sub-assembly part + await navigate(page, 'part/87/bom'); + + const assemblyRow = page + .getByRole('row') + .filter({ hasText: 'Widget Board (assembled)' }); + const assemblyDetails = page.getByRole('link', { name: 'details-part-88' }); + + await assemblyRow.getByRole('button', { name: 'nested-row-expand' }).click(); + await page.getByText('MAX232IDR').waitFor(); + await expect(assemblyDetails).toHaveCount(0); + await expect(page).toHaveURL(/part\/87\/bom/); + + await assemblyRow + .getByRole('button', { name: 'nested-row-collapse' }) + .click(); + await expect(page.getByText('MAX232IDR')).toHaveCount(0); + await expect(assemblyDetails).toHaveCount(0); + await expect(page).toHaveURL(/part\/87\/bom/); + + // Clicking a nested row opens the part for that row + await assemblyRow.getByRole('button', { name: 'nested-row-expand' }).click(); + await page.getByText('MAX232IDR').click(); + await page + .getByText('Part: MAX232IDR') + .or(page.getByRole('link', { name: 'details-part-61' })) + .first() + .waitFor(); +}); + /** * Perform BOM validation process * Note that this is a "background task" which is monitored by the "useBackgroundTask" hook