Skip to content

Commit

Permalink
Fix CollapseOne action. Fix jaegertracing#229
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuri Roncella committed Jul 24, 2018
1 parent e9e477d commit a841080
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ export function collapseOne(state, { payload }) {
const childrenHiddenIDs = spans.reduce((res, curSpan) => {
if (nearestCollapsedAncestor && curSpan.depth <= nearestCollapsedAncestor.depth) {
res.add(nearestCollapsedAncestor.spanID);
nearestCollapsedAncestor = curSpan;
if (curSpan.hasChildren) {
nearestCollapsedAncestor = curSpan;
}
} else if (curSpan.hasChildren && !res.has(curSpan.spanID)) {
nearestCollapsedAncestor = curSpan;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ describe('TraceTimelineViewer/duck', () => {
// --- 2
// - 3
// --- 4
// - 5
const spans = [
{ spanID: 0, depth: 0, hasChildren: true },
{ spanID: 1, depth: 1, hasChildren: true },
{ spanID: 2, depth: 2, hasChildren: false },
{ spanID: 3, depth: 1, hasChildren: true },
{ spanID: 4, depth: 2, hasChildren: false },
{ spanID: 5, depth: 1, hasChildren: false },
];

const oneSpanCollapsed = new Set([1]);
Expand Down

0 comments on commit a841080

Please sign in to comment.