fix(inference): official legend X works with overlay loaded + explicit hide/show affordances / 修复叠加层下图例移除按钮并明确隐藏/恢复操作提示#597
Merged
Conversation
…ay is loaded With an unofficial-run overlay active, the chart reads official series visibility from `localOfficialOverride` (the unified overlay-mode selection), but the legend's "X" (remove) button routed straight to InferenceContext's `removeHwType`, which mutates `activeHwTypes` — a set the chart ignores in overlay mode. Clicking an official SKU's X therefore appeared to do nothing, while the same click worked on official-only charts. The legend row TOGGLE already had the overlay-aware split (`unifiedToggle` → commitUnifiedSelection); the X now shares it: `handleRemoveHwType` commits the removal through the unified selection when an overlay is loaded and delegates to the context's `removeHwType` otherwise. Context state stays untouched in overlay mode, so dismissing the overlay restores the pre-overlay official selection — same semantics as the toggle path. Also lifts the overlay e2e fixtures (real run-29682242847 values, intercepts, countVisible) into cypress/support/overlay-fixtures.ts, shared by the existing overlay-optimal-only spec and the new overlay-legend-remove regression spec (which fails without the fix). Assertions in both specs now use retryable `.should()` callbacks — the dots' 150ms opacity transition made one-shot `.then()` counts racy. 中文:修复加载非官方运行叠加层时,图例中官方 SKU 的"X"(移除)按钮无效的问题。 叠加层激活时图表从 `localOfficialOverride`(叠加模式的统一选择集)读取官方系列 可见性,而图例的 X 按钮直接调用 InferenceContext 的 `removeHwType` 修改 `activeHwTypes`——该集合在叠加模式下被图表忽略,因此点击官方 SKU 的 X 看似无效, 而在纯官方图表上正常。图例行的切换(toggle)已有叠加感知分支(`unifiedToggle`), 现在 X 与其共用:加载叠加层时 `handleRemoveHwType` 通过统一选择集提交移除,否则 委托给 context 的 `removeHwType`;叠加模式下不触碰 context 状态,关闭叠加层即恢复 之前的官方选择,与切换路径语义一致。同时将叠加层 e2e 测试夹具(fixtures)提取到 cypress/support/overlay-fixtures.ts,由既有 overlay-optimal-only 与新增的 overlay-legend-remove 回归测试(未修复时失败)共享;两个测试的断言改用可重试的 `.should()` 回调(数据点 150ms 的透明度过渡使一次性 `.then()` 计数存在竞态)。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Make the two legend actions visually explicit: hovering an ACTIVE row swaps the color dot for the "Hide <label>" X (now with a matching tooltip), and hovering an INACTIVE row swaps the dimmed dot for a "+" with a "Show <label>" tooltip — signaling that clicking the SKU name brings the series back. The "+" is decorative (aria-hidden): the row's label/checkbox remains the single click target, so behavior is unchanged; only the affordance is new. Legend-item strings now go through a component-local locale dict (en/zh) per the site's bilingual-UI rule; the English strings are byte-identical to the previous literals. e2e assertions added: active row exposes the Hide tooltip, removed row exposes the Show "+" indicator and no Hide X. 中文:让图例行的两种操作在视觉上更明确:悬停"激活"行时,颜色圆点切换为"隐藏 <label>"的 X(新增对应 tooltip);悬停"未激活"行时,变暗的圆点切换为"+"并带 "显示 <label>" tooltip——明确提示点击 SKU 名称即可恢复该系列。"+" 为装饰性元素 (aria-hidden):行的 label/checkbox 仍是唯一点击目标,行为不变,仅新增视觉提示。 图例项字符串按站点双语规则改经组件内 locale 字典(en/zh)处理,英文字符串与原 字面量逐字节一致。新增 e2e 断言:激活行暴露隐藏 tooltip,被移除的行暴露"+"恢复 指示且无隐藏 X。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes to the chart legend, same surface:
1. Official legend "X" now works while an unofficial overlay is loaded (bug fix)
With an overlay active, the chart reads official series visibility from
localOfficialOverride(the unified overlay-mode selection), but the legend X routed straight to InferenceContext'sremoveHwType, which mutatesactiveHwTypes— a set the chart ignores in overlay mode (localOfficialOverride ?? activeHwTypes). Clicking an official SKU's X appeared to do nothing; on official-only charts it worked. The row toggle already had the overlay-aware split (unifiedToggle); the X did not.Fix (
ScatterGraph.tsx):handleRemoveHwTypemirrorshandleToggleHwType— overlay loaded → commit the removal throughcommitUnifiedSelection; otherwise delegate to the context'sremoveHwType. Context state stays untouched in overlay mode, so dismissing the overlay restores the pre-overlay official selection.2. Explicit hide/show affordances on legend rows (UX)
The two legend actions are now visually distinct: hovering an active row swaps the color dot for the "Hide" X (now with a matching tooltip); hovering an inactive row swaps the dimmed dot for a "+" with a "Show <label>" tooltip — making it explicit that clicking the SKU name brings the series back. The "+" is decorative (
aria-hidden); the row's label/checkbox remains the single click target, so behavior is unchanged. Legend-item strings go through a component-local en/zh dict per the bilingual-UI rule (English strings byte-identical to the previous literals).Tests
overlay-legend-remove.cy.ts: clicks the official B300 X with an overlay loaded, asserts official dots hide while overlay X markers stay, asserts the affordances (Hide tooltip on active row; "+" indicator and no X on the removed row), then re-activates from the legend. The removal test fails without fix chore: bump the all-minor-patch group with 2 updates #1.cypress/support/overlay-fixtures.ts(consumed by this spec andoverlay-optimal-only.cy.ts) instead of a third copy — the duplication flagged in fix(inference): align unofficial-run overlay x-axis + roofline with official chart / 对齐非官方运行叠加层的 x 轴与 roofline #596's review..should()callbacks (the dots' 150ms opacity transition made one-shot.then()counts racy).Overlay-path support
Fix #1 is a fix to the overlay path (AGENTS.md mandatory overlay support), verified end-to-end against the
?unofficialrun=fixture; official-only behavior delegates to the existing context handler unchanged. The affordance change applies uniformly to everyChartLegendItemconsumer.中文说明
对图表图例的两处改动:
1. 修复叠加层激活时官方 SKU 的"X"(移除)按钮无效的问题:叠加模式下图表从
localOfficialOverride(统一选择集)读取官方系列可见性,而图例 X 直接调用 InferenceContext 的removeHwType修改被图表忽略的activeHwTypes,导致点击看似无效(纯官方图表正常)。修复:handleRemoveHwType与已有叠加感知的切换路径(unifiedToggle)镜像——加载叠加层时经commitUnifiedSelection提交移除,否则委托给 context 的removeHwType;叠加模式下不触碰 context 状态,关闭叠加层即恢复之前的官方选择。2. 图例行的隐藏/恢复操作提示更明确(UX):悬停"激活"行时颜色圆点切换为"隐藏"X(新增对应 tooltip);悬停"未激活"行时变暗的圆点切换为 "+" 并带"显示 <label>" tooltip——明确提示点击 SKU 名称即可恢复该系列。"+" 为装饰性元素(
aria-hidden),行为不变。图例项字符串按双语规则改经组件内 en/zh 字典处理(英文字符串与原字面量逐字节一致)。测试:新增 e2e 测试
overlay-legend-remove.cy.ts(移除用例在未修复时失败),断言覆盖两种视觉提示;共享夹具提取到cypress/support/overlay-fixtures.ts(避免 #596 评审指出的重复);断言改用可重试的.should()回调。30 个叠加层相关 e2e、完整单元套件与既有基线一致、typecheck/lint/fmt 全部通过。