fix: clear children before building tree

prevents infinite loop on databases that have children array saved in database
v1.18.x
Barış Soner Uşaklı 6 years ago
parent 4f3ca4d899
commit 397e062a3c

@ -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]);
}

Loading…
Cancel
Save