Skip to content

Node.js based forum software built for the modern web

fix: clear children before building tree

Barış Soner Uşaklı397e062a3c7d
diff --git a/src/categories/index.js b/src/categories/index.js
index 76a16878d4..b201e8e204 100644
--- a/src/categories/index.js
+++ b/src/categories/index.js
@@ -395,6 +395,7 @@ Categories.getTree = function (categories, parentCid) {
const parents = {};
cids.forEach((cid, index) => {
if (cid) {
+ categories[index].children = undefined;
cidToCategory[cid] = categories[index];
parents[cid] = _.clone(categories[index]);
}