Skip to content

Commit 93ca5e3

Browse files
committed
option to hide orphans
1 parent db7d798 commit 93ca5e3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ window.onload = async (event) => {
118118
parent.skipped = true;
119119
}
120120
}
121-
}
122121

123-
// prune the events which were skipped
124-
for (const event of Object.values(events)) {
125-
if (event.skipped) delete events[event._event_id];
122+
// prune the events which were skipped
123+
for (const event of Object.values(events)) {
124+
if (event.skipped) delete events[event._event_id];
125+
}
126126
}
127127

128128
//console.log(JSON.stringify(events));
@@ -142,6 +142,16 @@ window.onload = async (event) => {
142142
.linkData((target, source) => { return { auth: source.auth_events.includes(target._event_id) } })
143143
.parentIds(parentIdFn)(Object.values(events));
144144

145+
console.log(dag);
146+
147+
const hideOrphans = true;
148+
if (hideOrphans) {
149+
if (dag.id === undefined) {
150+
// our root is an undefined placeholder, which means we have orphans
151+
dag.children = dag.children.filter(node=>(node.children.length > 0));
152+
}
153+
}
154+
145155
const width = 2000;
146156
const height = 4000;
147157

0 commit comments

Comments
 (0)