1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-07 14:35:26 +02:00

fix: add exit infinite loop

This commit is contained in:
Y-k-Y 2022-06-22 02:40:17 +09:00
parent f4e7264a82
commit 73f10cc811

View file

@ -128,10 +128,16 @@ class Pages {
return prev;
}, orderGroupedByParent);
let count = 0;
/**
* It groups remained ungrouped pages by its parent
*/
while (orphanPageOrder.length > 0) {
if (count >= 1000) {
break;
}
orphanPageOrder.forEach((orphanOrder, idx) => {
// It loops each of grouped orders formatted as [root page id(1): corresponding child pages id(2)]
Object.entries(orderGroupedByParent).forEach(([parentPageId, value]) => {
@ -144,6 +150,8 @@ class Pages {
}
});
});
count += 1;
}
/**