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

Moving folders with images out of the content collection while the dev server is running breaks it #13149

Open
1 task
ericswpark opened this issue Feb 6, 2025 · 3 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: content layer Related to the Content Layer feature (scope)

Comments

@ericswpark
Copy link
Contributor

Astro Info

Astro                    v5.2.5
Node                     v23.6.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

N/A

Describe the Bug

When the live Astro dev server is running, attempting to move any folder containing an image out of a content collection will break it and cause a build failure.

On StackBlitz, you should get something like this:

Image

What's the expected result?

The Astro dev server should not crash and not have a build failure if a piece of content is removed from the collection that references images

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-vo52mlan?file=src%2Fcontent%2Fblog%2Ftest-post%2Findex.md

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 6, 2025
@ematipico
Copy link
Member

I'm not sure I understand the problem.

You have a content collection that has an image and you render it. Then you move the file somewhere else and Astro tells you it can't find the image (you didn't update the file path in the schema of the collection).

Why is this incorrect?

@ematipico ematipico added the needs response Issue needs response from OP label Feb 7, 2025
@ericswpark
Copy link
Contributor Author

@ematipico that's not what I meant. Instead of the single image file, move out (or delete) the entire test-post directory and observe that the build still breaks. I do expect to get a 404 if the entire page is gone, but the build continues to fail until the dev server is restarted and the content collection is resynced.

@ericswpark
Copy link
Contributor Author

ericswpark commented Feb 8, 2025

For context, with a folder structure like this:

content/
  blog/
    some-blog-post-here/
      index.md
      image-1.png
  drafts/
    draft-blog-post/
      index.md
      image.jpg

and a single blog content collection, the bug makes it so that I can't quickly preview my draft posts by moving the draft-blog-post folder between drafts/ and blog/. Adding it to the blog/ is fine since additions seem to trigger a resync of the collection, but once I remove it again from the blog/ folder to the drafts/ folder then the build breaks for the entire blog collection until I restart the dev server.

@ematipico ematipico added - P3: minor bug An edge case that only affects very specific usage (priority) feat: content layer Related to the Content Layer feature (scope) and removed needs response Issue needs response from OP labels Feb 8, 2025
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: content layer Related to the Content Layer feature (scope)
Projects
None yet
Development

No branches or pull requests

2 participants