From d73a36d6bc2aff3768e27d87accecf90bf380ffd Mon Sep 17 00:00:00 2001 From: yyh Date: Thu, 29 Jan 2026 14:20:12 +0800 Subject: [PATCH] fix(inspect): add aria-hidden to decorative icon and use stable keys for path breadcrumb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mark the empty state SearchLinesSparkle icon as aria-hidden for screen readers. Replace array-index keys with cumulative path keys (O(n) vs O(n²)) to satisfy react/no-array-index-key and improve key stability. --- .../variable-inspect/artifacts-tab.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/artifacts-tab.tsx b/web/app/components/workflow/variable-inspect/artifacts-tab.tsx index 4025d32c0b..afdd2688ef 100644 --- a/web/app/components/workflow/variable-inspect/artifacts-tab.tsx +++ b/web/app/components/workflow/variable-inspect/artifacts-tab.tsx @@ -72,7 +72,7 @@ const ArtifactsTab: FC = (headerProps) => {
- +
{t('debug.variableInspect.tabArtifacts.emptyTitle')}
@@ -93,6 +93,12 @@ const ArtifactsTab: FC = (headerProps) => { } const file = selectedFile + const parts = file?.path.split('/') ?? [] + let cumPath = '' + const pathSegments = parts.map((part, i) => { + cumPath += (cumPath ? '/' : '') + part + return { part, key: cumPath, isFirst: i === 0, isLast: i === parts.length - 1 } + }) return ( = (headerProps) => { <>
- {file.path.split('/').map((part, i, arr) => ( - - {i > 0 && /} + {pathSegments!.map(seg => ( + + {!seg.isFirst && /} - {part} + {seg.part} ))}