Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidebar: auto does not update with document changes #2233

Open
1 task done
Enteleform opened this issue Mar 18, 2020 · 6 comments
Open
1 task done

sidebar: auto does not update with document changes #2233

Enteleform opened this issue Mar 18, 2020 · 6 comments

Comments

@Enteleform
Copy link

Enteleform commented Mar 18, 2020

  • I confirm that this is an issue rather than a question.

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

  • possibly related to Discrepency between TOC component and auto sidebar #1399

  • output of npx vuepress info in my VuePress project:

    System:
      OS: Windows 10 10.0.18362
      CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Binaries:
      Node: 12.6.0 - C:\_\Dev\NodeJS\12\node.EXE
      Yarn: 1.16.0 - C:\_\Dev\Yarn\bin\yarn.CMD
      npm: 6.9.0 - C:\_\Dev\NodeJS\12\npm.CMD
    Browsers:
      Edge: 44.18362.449.0
    npmPackages:
      @vuepress/core: Not Found
      @vuepress/theme-default: Not Found
      vuepress: ^1.3.1 => 1.4.0
    npmGlobalPackages:
      vuepress: Not Found
@Enteleform
Copy link
Author

Enteleform commented Mar 18, 2020

Update:

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

@Mister-Hope
Copy link
Contributor

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
Copy link
Contributor

@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
Copy link
Contributor

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

@Mister-Hope
Copy link
Contributor

Mister-Hope commented Apr 15, 2020

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
Copy link

sdwru commented Jul 17, 2020

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.

spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants