feat: allow collapsing child spans in trace timeline#1885
feat: allow collapsing child spans in trace timeline#1885karl-power wants to merge 2 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: d03ec79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review
|
E2E Test Results✅ All tests passed • 87 passed • 3 skipped • 964s
Tests ran across 4 shards in parallel. |
46e0983 to
8c5b037
Compare
8c5b037 to
25090af
Compare
25090af to
d03ec79
Compare
|
@alex-fedotyev Let me know if you have more thoughts on this UX. I've removed the tooltip for the moment (still visible in the video) as the feeling was that it was distracting/invasive. |
It looks like a completely hidden feature now... am I right?
|
Summary
Trace waterfall chart: Alt+click to collapse a node and all its children, plus memoization, tooltip UX.
Behavior
stopPropagationin the handler).Implementation
getDescendantIds: Recursively collects all descendant node ids from the tree; used when Alt+click collapses a node so every descendant id is added tocollapsedIds.toggleCollapse(id, event): Accepts the click event; on collapse, ifevent.altKeyis true, adds the node’s id and all ids fromgetDescendantIds(node)tocollapsedIds. Callsevent.stopPropagation()so the row is not selected.nodesMap,flattenedNodes) are computed in oneuseMemowith deps[collapsedIds, rows, validSpanIDs].timelineRowsis memoized in auseMemowith the appropriate deps so the timeline row list is not recomputed on every render.Tests
describe('getDescendantIds')inDBTraceWaterfallChart.test.tsxwith six unit tests: no children, undefined children, single level, nested tree, children without id (still recurses to grandchildren), single child.Screenshots or video
Untitled.mov
How to test locally or on Vercel
References