Fix operator precedence in timeline pageSize calculation - #303258
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoAug 7, 2026
Merged
Conversation
The nullish coalescing operator (??) has lower precedence than division (/), so `this.tree?.renderHeight ?? 0 / ItemHeight` parses as `this.tree?.renderHeight ?? (0 / ItemHeight)` instead of the intended `(this.tree?.renderHeight ?? 0) / ItemHeight`. This causes the fallback page size to use renderHeight directly (e.g. 500) instead of dividing by ItemHeight (22), resulting in ~24x over-fetching of timeline items on every load.
Copilot started reviewing on behalf of
Shehab Sherif (ShehabSherif0)
March 19, 2026 16:57
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an operator-precedence bug in TimelinePane.pageSize that caused pixel renderHeight values to be treated as an item count, leading to significant over-fetching in the Timeline view.
Changes:
- Adds parentheses around the nullish-coalescing expression to ensure
renderHeightis divided byItemHeightbefore computing the page size.
You can also share your feedback on Copilot code review. Take the survey.
Logan Ramos (lramos15)
approved these changes
Aug 6, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 6, 2026
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 6, 2026 17:03
Michael Lively (Yoyokrazy)
approved these changes
Aug 6, 2026
Connor Peet (connor4312)
approved these changes
Aug 6, 2026
Megan Rogge (meganrogge)
approved these changes
Aug 6, 2026
Dmitriy Vasyura (dmitrivMS)
disabled auto-merge
August 7, 2026 17:19
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 7, 2026 18:05
Dmitriy Vasyura (dmitrivMS)
merged commit Aug 7, 2026
6d0617c
into
microsoft:main
48 of 51 checks passed
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.
Fixes #303257
Bug
In
TimelinePane.pageSize, the nullish coalescing operator (??) has lower precedence than division (/), causingrenderHeight(pixels) to be used directly as the page size instead ofrenderHeight / ItemHeight(items).Current code
JavaScript parses this as
this.tree?.renderHeight ?? (0 / ItemHeight)because/binds tighter than??.When the tree exists (the common case),
renderHeightis a pixel value (e.g., 500). Without the division byItemHeight(22), the computed page size is ~499 instead of the intended ~22. This causes a ~24x over-fetch on every timeline load and "Load more" action.Fix
Add parentheses to enforce the intended grouping:
Verification
When the tree is null/undefined, both produce
pageSize = 20(viaMath.max), so the fallback path is unaffected.