Skip to content

Fix Timeline default page-size calculation and guard against non-finite heights#303286

Open
mrsandy1965 wants to merge 8 commits intomicrosoft:mainfrom
mrsandy1965:fix/timeline-page-size-precedence
Open

Fix Timeline default page-size calculation and guard against non-finite heights#303286
mrsandy1965 wants to merge 8 commits intomicrosoft:mainfrom
mrsandy1965:fix/timeline-page-size-precedence

Conversation

@mrsandy1965
Copy link

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:

  • Moved the default timeline page size calculation into a new utility function getDefaultTimelinePageSize in timelinePaging.ts, improving code clarity and maintainability. [1] [2]
  • Updated the import statements in timelinePane.ts to use the new utility function.

Testing improvements:

  • Added a new test suite timelinePaging.test.ts to cover various scenarios and edge cases for getDefaultTimelinePageSize, ensuring correct behavior for undefined, invalid, and extreme values.

Copilot AI review requested due to automatic review settings March 19, 2026 19:09
@mrsandy1965
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getDefaultTimelinePageSize for reuse and easier maintenance.
  • Updated TimelinePane to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants