Skip to content

Commit b36db07

Browse files
committed
docs: Add undefined check and replace reverse with unshift
1 parent 8354897 commit b36db07

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/documentation/.vitepress/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,12 @@ function guide() {
350350
}
351351
}
352352

353-
moveIndex.push({
354-
from: index,
355-
to: to
356-
});
353+
if (to !== undefined && to !== null) {
354+
moveIndex.push({
355+
from: index,
356+
to: to
357+
});
358+
}
357359
}
358360
}
359361

@@ -362,9 +364,7 @@ function guide() {
362364
for (const moveItem of moveIndex) {
363365
const item = tree.items[moveItem.from];
364366
item.text = "main";
365-
tree.items[moveItem.to].items = tree.items[moveItem.to].items.reverse();
366-
tree.items[moveItem.to].items.push(item);
367-
tree.items[moveItem.to].items = tree.items[moveItem.to].items.reverse();
367+
tree.items[moveItem.to].items.unshift(item);
368368
delete tree.items[moveItem.from];
369369
}
370370

0 commit comments

Comments
 (0)