mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-07 22:45:23 +02:00
fix: add exit infinite loop
This commit is contained in:
parent
f4e7264a82
commit
73f10cc811
1 changed files with 8 additions and 0 deletions
|
@ -128,10 +128,16 @@ class Pages {
|
||||||
return prev;
|
return prev;
|
||||||
}, orderGroupedByParent);
|
}, orderGroupedByParent);
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It groups remained ungrouped pages by its parent
|
* It groups remained ungrouped pages by its parent
|
||||||
*/
|
*/
|
||||||
while (orphanPageOrder.length > 0) {
|
while (orphanPageOrder.length > 0) {
|
||||||
|
if (count >= 1000) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
orphanPageOrder.forEach((orphanOrder, idx) => {
|
orphanPageOrder.forEach((orphanOrder, idx) => {
|
||||||
// It loops each of grouped orders formatted as [root page id(1): corresponding child pages id(2)]
|
// It loops each of grouped orders formatted as [root page id(1): corresponding child pages id(2)]
|
||||||
Object.entries(orderGroupedByParent).forEach(([parentPageId, value]) => {
|
Object.entries(orderGroupedByParent).forEach(([parentPageId, value]) => {
|
||||||
|
@ -144,6 +150,8 @@ class Pages {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue