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

Built content when served manually (not vitepress dev <src>) adds a 404 page at end of page, and later navigation loads the page there at bottom replacing 404 at the bottom. #1345

Closed
3 tasks done
Animeshz opened this issue Sep 15, 2022 · 2 comments
Labels
need more info Further information is requested

Comments

@Animeshz
Copy link

Animeshz commented Sep 15, 2022

Describe the bug

Mainly described in the title, further description is at 4th point of reproducing the error. This is reproduced in normal python http server, and seems to happen in github pages as well.

Might be related to #412, but I don't think its exactly the same behavior & cause.

Reproduction

  1. Download the repro and unzip, it should have the following content:
.
├── content
│   ├── first
│   │   ├── index.md
│   │   └── second.md
│   └── index.md
├── package.json
└── yarn.lock

vitepress-repro.zip

  1. Run yarn && yarn run content:build
    a site folder at project root should be created.
  2. Run python3 -m http.server -d . 4000, and lookup localhost:4000/site.
    Everything looks fine, you can navigate to First using navbar, and second.md file in first by left panel.
  3. Now refresh at the same localhost:4000/site/first/second.
    You should see the page is loaded but a 404 page is added at the bottom too, now if you try to navigate, the top of page remains as is, the bottom of page is instead replaced by the new content.

Expected behavior

Page should not append a 404 page, nor it should load navigated pages in bottom of page instead of replacing current page.

System Info

System:
    OS: Linux 5.18 Void
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 3.97 GB / 7.56 GB
    Container: Yes
    Shell: 3.5.1 - /usr/bin/fish
  Binaries:
    Node: 16.15.1 - /usr/bin/node
    Yarn: 1.22.18 - /usr/bin/yarn
    npm: 8.11.0 - /usr/bin/npm

Additional context

Full page screenshot

screencapture-localhost-4000-site-first-second-2022-09-15-17_56_03

Two errors, in order appears in the browser's console:

Failed to load resource: the server responded with a status of 404 (File not found) :4000/site/assets/first_second_index.md.undefined.lean.js:1

Hydration completed but contains mismatches. app.558d10a0.js:1

Point to be noted is that first_second_index.md.undefined.lean.js is trying to get fetched, i.e. the "undefined" hash.

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@Animeshz Animeshz added the bug: pending triage Maybe a bug, waiting for confirmation label Sep 15, 2022
@Animeshz
Copy link
Author

Seems to be that it happens only with cleanUrls: 'with-subfolders' in the content/.vitepress/config.js file.

So might be related with cache validation or etc. in the clean-url feature.

@brc-dd
Copy link
Member

brc-dd commented Sep 18, 2022

For with-subfolders option to work, your server must serve foo/index.md (without redirect) when requesting /foo (without trailing slash). I don't think a python http server will do that by default.

@brc-dd brc-dd added need more info Further information is requested and removed bug: pending triage Maybe a bug, waiting for confirmation labels Sep 26, 2022
@brc-dd brc-dd closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants