vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.49k stars 4.77k forks source link

`sidebar: auto` does not update with document changes #2233

Open Enteleform opened 4 years ago

Enteleform commented 4 years ago

Bug report

Steps to reproduce

  1. create a new VuePress project
  2. create ./docs/README.md
    • use setting sidebar: auto
    • add some headings & text
  3. run vuepress dev docs --host localhost
  4. delete some of the headings & text

What is expected?

  1. the main document text will update to reflect the changes
  2. the sidebar will update to reflect the new hierarchy of the document

What is actually happening?

  1. ✔️ the main document text reflects the changes
  2. ❌ the sidebar persists the hierarchy of the document that existed previous to the changes

VuePress-SidebarIssue

Other relevant information

Enteleform commented 4 years ago

Update:

I just noticed that changes made to themeConfig.sidebar are not reflected either.

Mister-Hope commented 4 years ago

Yes that is ture. The sidebar is rendered based on the $page or , the same object $site.pages.

This variable is generated when build starts, and will not change when hotload triggers.

So anything related to it won't support hotload, such as sidebar, frontmatter, prev and next links, last edit time and so on.

It's not a bug I think, just a feature enhancement.

Mister-Hope commented 4 years ago

@meteorlxy @kefranabg I have seen feture request like this a few times, why not make $site.pages support hot load?

I am willing to help, but I would like to ask first, as a few PR of me is not being reviewed so far.

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

haoranpb commented 4 years ago

I think it is a bug, see #1283 . They simply don't have the time to dig deep into it.

Mister-Hope commented 4 years ago

I followed this issue, but uliuz adds few comment in his code, so there are about 1/3 source code of @vuepress/core I can not understand it's meaning. A lot of functions have short names, and with plenty of variables, hard for me to figure out what is it doing. So ..... 😅 I think I cannot help with this one.

sdwru commented 4 years ago

I think it is a bug, see #1283 . They simply don't have the time to dig deep into it.

Then they don't have the time to create a working product because this is essential to a working product imo.