sylvainpolletvillard / vuepress-plugin-global-toc

A vuepress 1.x plugin to add a global table of contents
MIT License
7 stars 2 forks source link

Crashes when `sidebar` is set to `auto` #2

Closed Lemmingh closed 3 years ago

Lemmingh commented 3 years ago

When setting sidebar to auto, resolveSidebarItems()

https://github.com/vuejs/vuepress/blob/18f13a2ab2c06f5d75570ac969d5b0a8546dab24/packages/%40vuepress/theme-default/util/index.js#L124-L148

calls resolveHeaders()

https://github.com/vuejs/vuepress/blob/18f13a2ab2c06f5d75570ac969d5b0a8546dab24/packages/%40vuepress/theme-default/util/index.js#L154-L169

to return a SidebarGroup whose path is null.

Then, this plugin crashes at

https://github.com/sylvainpolletvillard/vuepress-plugin-global-toc/blob/0bcbc74885543b9b18e3e94651b6b17ad79f3941/GlobalTableOfContents.vue#L4


If it's hard to fix, please add a note to README at least. Thank you.

sylvainpolletvillard commented 3 years ago

it doesn't make sense to use sidebar:auto with this plugin since auto sidebar only retrieves the links of the current page, and the global ToC aims to retrieve the links of all pages

anyway, this should be fixed after #1 fix