From a72091c675b01f6473637514a1f60014f7dfc344 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Fri, 7 Jul 2023 13:15:15 -0400 Subject: [PATCH] fix: update sorting to match 2.9.0 behavior Signed-off-by: Trae Yelovich --- packages/zowe-explorer/src/job/ZoweJobNode.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/zowe-explorer/src/job/ZoweJobNode.ts b/packages/zowe-explorer/src/job/ZoweJobNode.ts index 912a1549ae..60abbcf1ff 100644 --- a/packages/zowe-explorer/src/job/ZoweJobNode.ts +++ b/packages/zowe-explorer/src/job/ZoweJobNode.ts @@ -217,14 +217,23 @@ export class Job extends ZoweTreeNode implements IZoweJobTreeNode { } // Only add new children that are not in the list of existing child nodes - const newChildren = Object.values(elementChildren) - .sort((a, b) => a.job.jobid - b.job.jobid) - .filter((c) => this.children.find((ch) => ch.label === c.label) == null); + const newChildren = Object.values(elementChildren).filter((c) => this.children.find((ch) => ch.label === c.label) == null); // Remove any children that are no longer present in the built record this.children = this.children .concat(newChildren) - .filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.jobid === ch.job.jobid) == null); + .filter((ch) => Object.values(elementChildren).find((recordCh) => recordCh.jobid === ch.job.jobid) == null) + .sort((a, b) => { + if (a.job.jobid > b.job.jobid) { + return 1; + } + + if (a.job.jobid < b.job.jobid) { + return -1; + } + + return 0; + }); } this.dirty = false; return this.children;