Repository navigation
Group a visual review's threads by case once per render instead of filtering every thread for each case - #6369
Merged
Conversation
…ltering every thread for each case Each render of lf-visual-review drew every case's article, and each case filtered the page's whole thread list, while each queue row found its number with run.cases.indexOf. A redraw, which follows every state reading and every selection, cost cases x threads + cases^2. The render now groups the threads anchored on this widget by datum once and hands each case its group, and the queue row takes its number from repeat's index. No behavior changes: the grouping keeps exactly the threads the old filter kept (anchor.section equal to the widget's id and anchor.datum equal to the case's id).
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.
Each render of
lf-visual-reviewdrew every case's article, and each case filtered the page's whole thread list, while each queue row found its number withrun.cases.indexOf(record). A redraw follows every state reading and every selection (#selectcallsperformUpdate), so it cost cases × threads + cases², the cross-collection walk rootAGENTS.md("Responsiveness") rules out.The render now groups the threads anchored on this widget by
anchor.datumonce and passes each case its group, and the queue row takes its number fromrepeat's index (#casesmapsrun.casesin order). Behavior is unchanged: the grouping keeps exactly the threads the old filter kept, those whoseanchor.sectionis the widget's id and whoseanchor.datumis the case's id.Verification:
pnpm run checkpasses, and these focused browser tests pass:test_render_visual_review_journey.py::test_visual_review_returns_to_case_feedback_on_phone(two threads on a case, counted and opened),::test_visual_review_source_reorder_keeps_the_focused_case_draftand::test_visual_review_approvals_survive_reload_and_undo, plusprojection/test_visual_review.py::test_visual_review_controls_keep_keyboard_navigation_localand::test_on_me_materializes_a_reply_review_at_its_requested_case. The widget is a Lit element with no Node-level seam, so no unit test was added for the grouping.No speedup is measured:
leaf-dev benchgenerates no page with a visual review, so the gain is the asymptotic one above.