change timing markers to be precise on the timeline #2775
Open
mitul-s wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: 60e16a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
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.
What
Makes the timing labels on the trace viewer timeline precise when zoomed in.
When the timeline is zoomed in far enough that the ruler's tick step drops below one second, the tick labels were formatted with whole-second precision. This produced duplicate, imprecise labels — e.g. a ~3s window with a 500ms step rendered
0s, 1s, 1s, 2s, 2s, 3sinstead of distinct values. This PR scales each label's decimal precision to the tick step so every tick reads accurately.Changes
computeTimeMarkers(new-trace-viewer/utils.ts) — derivefractionDigitsfrom the tick interval. Steps>= 1skeep clean whole-second labels; sub-second steps use enough decimals to stay distinct (e.g.500ms,1.5s,2.5s).formatDurationPrecise(lib/utils.ts)fractionDigitsargument (default2) that controls both the number of decimals and the rounding granularity.2.00s→2sand1.50s→1.5s, while sub-second detail is preserved (1626ms→1.63s, never2s).Intl.NumberFormathelper in favor oftoFixed(fractionDigits).formatDurationtoformatDurationPreciseso gap durations and the hovered-time indicator show the same precise values.Tests
computeTimeMarkerstests covering sub-second, whole-second, and millisecond-zoom windows, asserting labels are distinct.formatDurationPrecisetests for millisecond values, sub-second precision, trailing-zero trimming, the customfractionDigitsargument, and minute-plus decomposition.Changeset
Patch release for
@workflow/web-shared.