Fix Timeline default page-size calculation and guard against non-finite heights#303286
Open
mrsandy1965 wants to merge 8 commits intomicrosoft:mainfrom
Open
Fix Timeline default page-size calculation and guard against non-finite heights#303286mrsandy1965 wants to merge 8 commits intomicrosoft:mainfrom
mrsandy1965 wants to merge 8 commits intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes and hardens the Timeline view’s “auto” page-size calculation by extracting the logic into a dedicated helper and adding unit tests to cover edge cases (e.g., undefined and non-finite heights).
Changes:
- Extracted the default page-size computation into
getDefaultTimelinePageSizefor reuse and easier maintenance. - Updated
TimelinePaneto use the new helper (fixing the previous calculation issue). - Added a new unit test suite covering normal and edge-case inputs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/vs/workbench/contrib/timeline/test/common/timelinePaging.test.ts |
Adds unit tests for getDefaultTimelinePageSize, including edge cases for invalid/non-finite inputs. |
src/vs/workbench/contrib/timeline/common/timelinePaging.ts |
Introduces getDefaultTimelinePageSize with guards for item/render height values. |
src/vs/workbench/contrib/timeline/browser/timelinePane.ts |
Replaces inline page-size math with the new helper for correctness and clarity. |
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.
This pull request refactors and improves the calculation of the default timeline page size in the timeline pane. The main change is the extraction of the page size logic into a new utility function, which is now thoroughly unit tested. This makes the code more maintainable and robust, especially in handling edge cases for item and render heights.
Refactoring and logic extraction:
getDefaultTimelinePageSizeintimelinePaging.ts, improving code clarity and maintainability. [1] [2]timelinePane.tsto use the new utility function.Testing improvements:
timelinePaging.test.tsto cover various scenarios and edge cases forgetDefaultTimelinePageSize, ensuring correct behavior for undefined, invalid, and extreme values.