Repository navigation
perf(listbox): compute row position flags once per order change - #583
Draft
kianbazza wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kianbazza
force-pushed
the
ui-641-compute-row-position-flags-once-per-order-change
branch
from
October 10, 2026 23:33
4cde3a3 to
851a609
Compare
This branch was successfully deployed
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.
Summary
Each positional selector filtered the whole row order for every row on every store update, so a long menu paid roughly rows² work per update. The positions are now worked out once per order change and every selector is a lookup.
The same change applies to
isFirstRow,isLastRow,isFirstGroup,isLastGroupandisLastInGroup.orderedRowsis already replaced wholesale whenever a row mounts or unmounts, so the array itself keys the cache.Evidence
ListboxStore.test.ts› "reads the row order a bounded number of times per order change": 101 rows. It counts reads oforderedRowselements while every row's six selectors run, then runs them again after a highlight change, which notifies the store without changing the order.AssertionError: expected 61206 to be less than or equal to 101After: passes, with the flags checked for the first, last, first-in-group and last-in-group rows
positional-attrs.test.tsxpasses unchanged.Merge Danger
Door: two-way
Blast Radius: small
A wrong lookup would put
data-first,data-last,data-first-group,data-last-group,data-first-in-groupordata-last-in-groupon the wrong row, which changes styling but not behaviour.positional-attrs.test.tsxcovers these attributes through filtering.Closes UI-641