Repository navigation
fix(opportunities): selection toggle no longer reorders table rows - #775
Conversation
…loses #768) cellScoreFor() had a short-circuit that swapped a cell's sort key to the selected variant's individual value when selectedRecs contained any variant in that cell. Because that individual value (e.g. a single term or upfront) can differ from the deterministic cell-summary score used for unselected cells, toggling any checkbox mutated sort scores and re-sorted the table. Fix: remove selectedRecs from cellScoreFor() and groupsInSortOrder() entirely. Sort order is now always derived from the cell-summary score (same path that was already used when nothing was selected). The selectedRecs set continues to flow into buildVariantRowMarkup for per-row checked-state rendering and CSS, and into renderRecommendationsSummary for the summary-card narrowing -- neither of those paths affects sort order. Regression tests added: one verifying term-sort is selection-independent (the buggy variant would have changed mixed-cell's score from 103 to 303 when its 3yr variant was selected), and one asserting row order is byte-identical before and after toggling two checkboxes.
|
Warning Review limit reached
More reviews will be available in 59 minutes and 54 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Summary
QA 6.1: toggling a row's checkbox on the Opportunities table reordered visible rows.
Root cause
cellScoreFor()accepted aselectedRecs: ReadonlySet<string>parameter and had a short-circuit that, when any variant in a cell was selected, substituted the selected variant's individual value as the cell's sort key. That individual value differs from the deterministic cell-summary score used for unselected cells, so every checkbox toggle mutated sort scores and triggered a full re-sort.Example: a cell with 1yr + 3yr variants normally sorted by score 103; selecting the 3yr variant changed the cell's score to 303, jumping the row.
Fix
Removed
selectedRecsfromcellScoreForandgroupsInSortOrderentirely. Sort order now always derives from the cell-summary path.selectedRecsstill flows to row-level rendering (checkboxes,selectedCSS class, summary cards) -- behavior there is unchanged.Files changed
frontend/src/recommendations.tsfrontend/src/__tests__/recommendations.test.tsTest plan
Closes #768.