Timeline markers - #275
Conversation
Codecov Report
@@ Coverage Diff @@
## master #275 +/- ##
==========================================
+ Coverage 71.08% 71.91% +0.83%
==========================================
Files 59 60 +1
Lines 3247 3351 +104
==========================================
+ Hits 2308 2410 +102
- Misses 939 941 +2
Continue to review full report at Codecov.
|
|
I pulled out the canvas logic into its own separate component. Next up is re-use the TimelineCanvas component for the TImelineFlameChart. |
fbd1ad0 to
d89d468
Compare
4fe9c72 to
7487dc5
Compare
|
This is now ready for review. This is a first pass and I have many follow-ups I would like to do. If you could be specific on review changes on what can be follow-ups I would appreciate it. Follow-ups
|
|
|
|
I think it's my recent |
julienw
left a comment
There was a problem hiding this comment.
I left several comments, some of them perf related, others style related , others as suggestions.
I admit I haven't looked so much at the canvas code, I'll trust you on this.
The feature is quite cool and works fine. I'd rather see it in rather than make it perfect. So if you prefer to move some of my comments to follow-ups it's fine by me.
| onDoubleClickItem={this.onDoubleClickStack} | ||
| getHoveredItemInfo={this.getHoveredStackInfo} | ||
| drawCanvas={this.drawCanvas} | ||
| hitTest={this.hitTest} />; |
There was a problem hiding this comment.
nit: should all of the functions names be prefixed by an underscore ?
There was a problem hiding this comment.
Yeah, that would be more consistent with the codebase. I'll update it. I'm not sure (from a bikeshedding point of view) of what utility underscore has for React classes' member functions, as the class instances are never used by anyone, so all class functions are implicitly private.
There was a problem hiding this comment.
TBH I usually don't care, but it's just what I've been told in this project ;)
| } | ||
|
|
||
| .timelineCanvas.hover { | ||
| cursor: default; |
There was a problem hiding this comment.
nit: have you tried putting the "cursor: default" on the above block ?
There was a problem hiding this comment.
The behavior here is to show the grab cursor on the Timeline when not hovering over a stack frame, then when you hover over a stack frame it changes to the default cursor.
| const { className, drawCanvas } = this.props; | ||
| if (!this._requestedAnimationFrame) { | ||
| this._requestedAnimationFrame = true; | ||
| window.requestAnimationFrame(() => { |
There was a problem hiding this comment.
optional nit: you can assign to _requestedAnimationFrame the result of window.requestAnimationFrame.
| _ctx: CanvasRenderingContext2D | ||
| state: { | ||
| hoveredItem: null | HoveredItem; | ||
| } |
There was a problem hiding this comment.
nit: please put semicolons at the end of these lines
| _ctx: null|CanvasRenderingContext2D | ||
| _textMeasurement: null | TextMeasurement | ||
|
|
||
| props: Props |
There was a problem hiding this comment.
nit: can you put a semicolon at the end of these lines ?
There was a problem hiding this comment.
Yeah, we should have a linting rule in place that covers this. I looked for one briefly but didn't find one, although maybe we can just switch to prettier.
| </div> | ||
| <Reorderable tagName='div' | ||
| className={`${className}ThreadList`} | ||
| className={'timelineViewTimelinesThreadList'} |
There was a problem hiding this comment.
nit: you don't need the {} syntax, just put the class as a string :)
| markerTimingRows = markerTimingRows.concat(value); | ||
| } | ||
| return markerTimingRows; | ||
| } |
There was a problem hiding this comment.
Optional, but do you think you can split this function is several parts ? For example, the Map handling could be extracted into a higher-level component ?
| // Handle different marker payloads. | ||
| switch (data.type) { | ||
| case 'UserTiming': | ||
| return (data: UserTimingMarkerPayload).name; |
There was a problem hiding this comment.
Optional nit: not sure the flow annotation is useful here.
There was a problem hiding this comment.
I mainly did it as documentation, would it be better to leave this out?
| let markerTimingRows = []; | ||
| for (const [, value] of markerTimingsMap) { | ||
| markerTimingRows = markerTimingRows.concat(value); | ||
| } |
There was a problem hiding this comment.
I think this just work to flatten: [].concat(...marketTimingRows.values());
without intermediary arrays :)
| query.react_perf = null; | ||
| /* eslint-enable camelcase */ | ||
| } | ||
|
|
There was a problem hiding this comment.
pretty sure this landed elsewhere :)
| </div> | ||
| <div className={`${className}HeaderIntervalMarkerOverviewContainer ${className}HeaderIntervalMarkerOverviewContainerGfx`}> | ||
| { | ||
| {/* |
There was a problem hiding this comment.
I think we should keep the tracing markers at the top until this tab is more polished.
There was a problem hiding this comment.
Woops, I knew I forgot something. Thanks I meant to bring this up. Will do.
| user-select: none; | ||
| } | ||
|
|
||
| .timelineMarkersLabels > span { |
There was a problem hiding this comment.
Please set a class name on the span instead.
|
|
||
| _prepCanvas() { | ||
| const {canvas} = this.refs; | ||
| const {containerWidth, containerHeight} = this.props; |
There was a problem hiding this comment.
I think we need to pick one style here and add a lint for it. At the moment we have a wild mix of hugging braces and spaced braces.
There was a problem hiding this comment.
Sounds good, I'm ready to take on prettier at this point.
7487dc5 to
e0329ea
Compare
e0329ea to
7cba79f
Compare
7cba79f to
e15876f
Compare
This is a work in progress for timeline markers. I need to clean up a bunch of stuff. @mikeconley this is here if you want to check it out, but I'm only showing
TracingMarkers, or markers that we can determine have a start and end time. YourAsyncTabSwitcharen't being turned intoTracingMarkers right now.