Skip to content

Sidebar Experience Different between Dev Mode and Build Mode #2670

Open
@isaacrlevin

Description

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

Bug report

Steps to reproduce

  • Create new vuepress site
  • add few pages in guide with tags
  • eject theme
  • modify resolveSidebarItems in theme/utils/index to walk pages and grab tags and group
 let tags = []
  for (let page of sortedPages) {
    for (let index in page.frontmatter.tags) {
      const tag = page.frontmatter.tags[index]
      var result = tags.find(t => {
        return t.title.toLowerCase().trim() === tag.toLowerCase().trim()
      });
      if (result == undefined)
      {
        let finalTag = {};
        finalTag.title = tag.toLowerCase().trim();
        finalTag.collapsable = true;
        finalTag.children = [];
        finalTag.children.push(page.regularPath.replace(".html",""));
        tags.push(finalTag);
      }
      else
      {
        if (result.children != undefined)
        {
          result.children.push(page.regularPath.replace(".html",""));
        }
      }
    }
  }

and concat group to config output

    let newconfig = config.concat(tags);

    return newconfig
      ? newconfig.map(item => resolveItem(item, pages, base))
      : []

vuepress dev to test than vuepress build

What is expected?

output of vuepress build should have sidebar groups collapsible (this will work fine in dev mode)

yep

What is actually happening?

Built site groups cannot be toggled, they stay collapsed. This is something that works find in dev mode, but built is not the same expereince

Other relevant information

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
  Binaries:
    Node: 12.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 86.0.4240.75
    Edge: Spartan (44.19041.423.0), Chromium (86.0.622.43), ChromiumDev (87.0.664.8)
  npmPackages:
    @vuepress/core:  1.6.0
    @vuepress/theme-default:  1.6.0
    vuepress: ^1.6.0 => 1.6.0
  npmGlobalPackages:
    vuepress: Not Found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions