fix(ui/recommendations): preserve (All) tri-state and table header after Clear (followup #482) - #712
Merged
cristim merged 1 commit intoMay 25, 2026
Conversation
…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.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
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)andsetRecommendationsColumnFilterinline, bypassingcommitAll()and never callingupdateAllTriState(). Fix: introduce acommitAllRefin the outer scope ofbuildPopoverContent, assign it inside the categoricalelseblock to thecommitAllclosure, and callcommitAllRef?.(false)from the Clear handler. Numeric branch keeps its ownrerenderRecommendations().Bug 2 — table header disappears on zero-row result
renderRecommendationsListwas early-returning withcontainer.innerHTML = '<p class="empty">...'when filter yielded zero rows, destroying<thead>. Fix: remove the early return;buildListMarkupalways runs (even for zero rows it produces a proper<thead>+ empty<tbody>). WhenemptyResultis true, inject a<td class="empty" colspan=N>hint row into the existing<tbody>via DOM methods (no newinnerHTML).Tests
shows empty-state message when no recommendationsto assert<thead>presence + the newtd.emptyhint cell.Issue #700: Clear resets (All) checkbox to unchecked (not indeterminate)— wires the filter-state mock to update, assertsallBox.checked === false && allBox.indeterminate === false.Issue #700: table <thead> survives a filter that yields zero rows— mocks an empty allow-list, assertstheadpresent +td.emptypresent + nop.empty.All 1933 frontend tests pass, TypeScript clean.