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

Detailed list doesn't work with docs:preview (only works with docs:dev) #2485

Closed
4 tasks done
Fil opened this issue Jun 7, 2023 · 3 comments
Closed
4 tasks done

Detailed list doesn't work with docs:preview (only works with docs:dev) #2485

Fil opened this issue Jun 7, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Fil
Copy link

Fil commented Jun 7, 2023

Describe the bug

Hello, thank you so much for vitepress — we are using it for https://observablehq.com/plot/

Currently we see that the instant search detailed list feature works in docs:dev but does not work with docs:preview (nor in production).

We are currently using v1.0.0-alpha.72, but I tried locally upgrading to v1.0.0-beta.1 and the issue is still here.

Reproduction

Clone https://github.com/observablehq/plot
change vitepress version to v1.0.0-beta.1 in package.json
run yarn; yarn docs:build; yarn docs:preview
open the site and search “color”

screenshot: left: docs:dev; right: docs:preview

vitepress-search-screen

Expected behavior

The detailed list should appear.

System Info

System:
    OS: macOS 13.3.1
    CPU: (8) arm64 Apple M1
    Memory: 63.64 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.1.0 - ~/.nvm/versions/node/v20.1.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.6.4 - ~/.nvm/versions/node/v20.1.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.106
    Firefox: 113.0.2
    Safari Technology Preview: 16.4
  npmPackages:
    vitepress: ^1.0.0-beta.1 => 1.0.0-beta.1

Additional context

No response

Validations

@Fil Fil added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 7, 2023
@brc-dd brc-dd added bug Something isn't working and removed bug: pending triage Maybe a bug, waiting for confirmation labels Jun 7, 2023
@brc-dd
Copy link
Member

brc-dd commented Jun 7, 2023

Somehow render function is missing from comp here in build

const comp = mod.default ?? mod
if (comp?.render) {

@brc-dd
Copy link
Member

brc-dd commented Jun 7, 2023

I think we can fix this, but there is a change required at your side too. Your csv file paths need slight refactoring: (Example, usage in other files also needs to be updated.)

-  d3.csv("../data/aapl.csv", d3.autoType).then((data) => (aapl.value = data));
-  d3.csv("../data/goog.csv", d3.autoType).then((data) => (goog.value = data));
-  d3.csv("../data/sf-temperatures.csv", d3.autoType).then((data) => (sftemp.value = data));
+  d3.csv(withBase("/data/aapl.csv"), d3.autoType).then((data) => (aapl.value = data));
+  d3.csv(withBase("/data/goog.csv"), d3.autoType).then((data) => (goog.value = data));
+  d3.csv(withBase("/data/sf-temperatures.csv"), d3.autoType).then((data) => (sftemp.value = data));

withBase can be imported from vitepress. Or, you can just hardcode them as /plot/data/aapl.csv too, whatever you find easier/faster to do.

@brc-dd
Copy link
Member

brc-dd commented Jun 7, 2023

fixed in 80e734d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants