From 4e4226416e87f8f6b3a4bba378e8e06efd11ecaa Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Wed, 25 Nov 2026 11:48:18 +0800 Subject: [PATCH] fix(intake): keep product library content in the viewport --- .../layout/ProductWorkspaceTabs.tsx | 4 +- .../__tests__/ProductWorkspaceTabs.test.tsx | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/furniture-3d-system/src/components/layout/ProductWorkspaceTabs.tsx b/furniture-3d-system/src/components/layout/ProductWorkspaceTabs.tsx index bb67380d..3807f526 100644 --- a/furniture-3d-system/src/components/layout/ProductWorkspaceTabs.tsx +++ b/furniture-3d-system/src/components/layout/ProductWorkspaceTabs.tsx @@ -252,6 +252,8 @@ export function ProductWorkspaceTabs({ const showRouteBar = Boolean(label && pathname !== INTAKE_PATH && pathname !== PRODUCT_LIBRARY_PATH) const intakePanelReady = pathname === INTAKE_PATH && Boolean(activePanel) + // The retained panel takes over the viewport from the original route container. + const showRouteContent = !parkRoute && !activePanel return ( )} -
+
diff --git a/furniture-3d-system/src/components/layout/__tests__/ProductWorkspaceTabs.test.tsx b/furniture-3d-system/src/components/layout/__tests__/ProductWorkspaceTabs.test.tsx index fb73180b..162c2242 100644 --- a/furniture-3d-system/src/components/layout/__tests__/ProductWorkspaceTabs.test.tsx +++ b/furniture-3d-system/src/components/layout/__tests__/ProductWorkspaceTabs.test.tsx @@ -73,3 +73,40 @@ describe('产品信息正文加载', () => { } }) }) + +describe('共用工作页签的正文布局', () => { + it.each([ + { path: '/intake', routeSegments: ['intake'], title: '产品信息' }, + { path: '/intake/product-library', routeSegments: ['intake', 'product-library'], title: '产品资料' }, + ])('$title 的正文接管首屏,并在切回时复用', ({ path, routeSegments, title }) => { + const navigate = jest.fn() + const renderPage = (pathname: string, route: React.ReactNode) => ( + +
{route}
+
+ ) + const panel = ( + + + + ) + + segments = routeSegments + const { rerender } = render(renderPage(path, panel)) + const filter = screen.getByRole('textbox', { name: `${title}筛选` }) + expect(filter).toBeVisible() + expect(screen.getByTestId('route-root')).not.toBeVisible() + + segments = ['database', 'boards'] + const boards =

板材资料库正文

+ rerender(renderPage('/database/boards', boards)) + expect(screen.getByRole('heading', { name: '板材资料库正文' })).toBeVisible() + expect(filter).not.toBeVisible() + + rerender(renderPage(path, boards)) + expect(screen.getByRole('textbox', { name: `${title}筛选` })).toBe(filter) + expect(filter).toBeVisible() + expect(screen.getByTestId('route-root')).not.toBeVisible() + expect(navigate).not.toHaveBeenCalled() + }) +})