Skip to content

Commit

Permalink
Fix CollapseOne action. Fix jaegertracing#229 (jaegertracing#230)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Roncella <yroncella@apple.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
  • Loading branch information
yuribit authored and tiffon committed Jul 25, 2018
1 parent c00d063 commit e8fd1e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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
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 e8fd1e4

Please sign in to comment.