Skip to content

fix(ui/recommendations): preserve (All) tri-state and table header after Clear (followup #482) - #712

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/700-filter-clear-tristate-and-header
May 25, 2026
Merged

fix(ui/recommendations): preserve (All) tri-state and table header after Clear (followup #482)#712
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/700-filter-clear-tristate-and-header

Conversation

@cristim

@cristim cristim commented May 25, 2026

Copy link
Copy Markdown
Member

Closes #700. Two sub-bugs in the column-filter Clear button surfaced by QA after PR #491:

Bug 1 — (All) checkbox tri-state desync

Clear's categorical branch was directly toggling checkboxes.forEach(cb => cb.checked = false) and setRecommendationsColumnFilter inline, bypassing commitAll() and never calling updateAllTriState(). Fix: introduce a commitAllRef in the outer scope of buildPopoverContent, assign it inside the categorical else block to the commitAll closure, and call commitAllRef?.(false) from the Clear handler. Numeric branch keeps its own rerenderRecommendations().

Bug 2 — table header disappears on zero-row result

renderRecommendationsList was early-returning with container.innerHTML = '<p class="empty">...' when filter yielded zero rows, destroying <thead>. Fix: remove the early return; buildListMarkup always runs (even for zero rows it produces a proper <thead> + empty <tbody>). When emptyResult is true, inject a <td class="empty" colspan=N> hint row into the existing <tbody> via DOM methods (no new innerHTML).

Tests

  • Updated shows empty-state message when no recommendations to assert <thead> presence + the new td.empty hint cell.
  • New Issue #700: Clear resets (All) checkbox to unchecked (not indeterminate) — wires the filter-state mock to update, asserts allBox.checked === false && allBox.indeterminate === false.
  • New Issue #700: table <thead> survives a filter that yields zero rows — mocks an empty allow-list, asserts thead present + td.empty present + no p.empty.

All 1933 frontend tests pass, TypeScript clean.

…ter Clear

Closes #700

Two sub-bugs in the column filter popover and the zero-row render path:

1. Clear-categorical handler called checkboxes.forEach + setRecommendationsColumnFilter
   directly, bypassing commitAll(). That skipped updateAllTriState() so the (All)
   checkbox remained checked or indeterminate after Clear. Fix: expose commitAll as
   commitAllRef in the outer scope and delegate to it from the Clear handler, keeping
   the same call path as the (All) checkbox itself.

2. renderRecommendationsList replaced the entire container (including <thead>) with a
   <p class="empty"> when the filter produced zero rows. Fix: always call
   buildListMarkup so <thead> is preserved, then inject a hint <td class="empty">
   into the empty <tbody> via DOM methods.

Tests: 2 new Issue #700 tests added (tri-state visual state + thead survival),
existing empty-state test updated to match new structure. All 1933 frontend tests pass.
@cristim cristim added triaged Item has been triaged priority/p1 Next up; this sprint severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/bug Defect labels May 25, 2026
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e73f330e-59c8-45f4-9b8e-7d6ac6bafd06

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/700-filter-clear-tristate-and-header

Comment @coderabbitai help to get the list of available commands and usage tips.

@cristim
cristim merged commit e7103d8 into feat/multicloud-web-frontend May 25, 2026
5 checks passed
@cristim
cristim deleted the fix/700-filter-clear-tristate-and-header branch May 25, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/many Affects most users priority/p1 Next up; this sprint severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant