Skip to content

Commit

Permalink
Check if same id when adding process under parent
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizhou Wang committed Nov 25, 2021
1 parent e0cd5bf commit c125580
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x-pack/plugins/session_view/public/hooks/use_process_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ class ProcessImpl implements Process {
({ event }) => event.action === EventAction.exec || event.action === EventAction.fork
);

const execs = execsForks.filter(({ event }) => event.action === EventAction.exec);

if (execs.length) {
return execs[execs.length - 1];
}

if (execsForks.length === 0) {
// eslint-disable-next-line no-debugger
debugger;
Expand Down Expand Up @@ -249,7 +255,7 @@ export const useProcessTree = ({
if (parentProcess) {
process.parent = parentProcess; // handy for recursive operations (like auto expand)

if (!parentProcess.children.includes(process)) {
if (!parentProcess.children.includes(process) && parentProcess.id !== process.id) {
if (backwardDirection) {
parentProcess.children.unshift(process);
} else {
Expand Down

0 comments on commit c125580

Please sign in to comment.