mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-20 11:37:52 +02:00
fix(v2): throw error if first level item of a sidebar is not category (#1994)
This commit is contained in:
parent
472a1a660c
commit
4e5a03fb88
3 changed files with 30 additions and 0 deletions
|
@ -39,6 +39,13 @@ function normalizeCategory(
|
|||
category: SidebarItemCategoryRaw,
|
||||
level = 0,
|
||||
): SidebarItemCategory {
|
||||
if (level === 0 && category.type !== 'category') {
|
||||
throw new Error(
|
||||
`Error loading ${JSON.stringify(
|
||||
category,
|
||||
)}. First level item of a sidebar must be a category`,
|
||||
);
|
||||
}
|
||||
assertItem(category, ['items', 'label']);
|
||||
|
||||
if (!Array.isArray(category.items)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue