Skip to content

fix(inference): official legend X works with overlay loaded + explicit hide/show affordances / 修复叠加层下图例移除按钮并明确隐藏/恢复操作提示#597

Merged
Oseltamivir merged 2 commits into
masterfrom
fix/overlay-legend-official-remove
Jul 20, 2026
Merged

fix(inference): official legend X works with overlay loaded + explicit hide/show affordances / 修复叠加层下图例移除按钮并明确隐藏/恢复操作提示#597
Oseltamivir merged 2 commits into
masterfrom
fix/overlay-legend-official-remove

Conversation

@Oseltamivir

@Oseltamivir Oseltamivir commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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's removeHwType, which mutates activeHwTypes — 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): handleRemoveHwType mirrors handleToggleHwType — overlay loaded → commit the removal through commitUnifiedSelection; otherwise delegate to the context's removeHwType. 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-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 every ChartLegendItem consumer.

中文说明

对图表图例的两处改动:

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 全部通过。

…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()` 计数存在竞态)。
@Oseltamivir
Oseltamivir requested a review from adibarra as a code owner July 20, 2026 05:26
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview, Comment Jul 20, 2026 5:39am

Request Review

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。
@Oseltamivir Oseltamivir changed the title fix(inference): official legend X works while an unofficial overlay is loaded / 修复叠加层激活时图例官方 SKU 移除按钮无效 fix(inference): official legend X works with overlay loaded + explicit hide/show affordances / 修复叠加层下图例移除按钮并明确隐藏/恢复操作提示 Jul 20, 2026
@Oseltamivir
Oseltamivir merged commit bc30638 into master Jul 20, 2026
23 checks passed
@Oseltamivir
Oseltamivir deleted the fix/overlay-legend-official-remove branch July 20, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant