slidev icon indicating copy to clipboard operation
slidev copied to clipboard

Imported snippets don't reload automatically

Open kubukoz opened this issue 4 months ago • 3 comments

Describe the bug

Whenever I use the <<< syntax to import a code snippet, and change the given file's contents, it doesn't get refreshed in the presentation until I do either:

  1. modify the exact slide that includes the snippet
  2. restart slidev altogether

Minimal reproduction

Steps to reproduce the behavior:

  1. Create a sample project
  2. Import a snippet
  3. Start slidev and open the slides
  4. Modify snippet
  5. Check if it's reflected in the slides

Environment

  • Slidev version: 52.1.0
  • Browser: Firefox
  • OS: macOS

kubukoz avatar Aug 11 '25 00:08 kubukoz

It seems to me like the last added snippet is actually reloaded, all the previous ones are not, so it feels like only the last file is monitored for changes, but I haven't checked the code, so I'm not sure if this assumption is correct, just thought to add it here in case it can help debugging the issue. I'll try to have a look at the code once I have time

pasdam avatar Oct 02 '25 15:10 pasdam

I am afraid that I can't reproduce the issue - I may have gotten some steps wrong. Could you create a reproduction on https://sli.dev/new?

kermanx avatar Nov 16 '25 04:11 kermanx

Yes, I was just able to reproduce it there.

  1. Go to https://stackblitz.com/edit/github-diqxvyd9
  2. Wait for server to start and slides to load
  3. Open slide 1 in browser
  4. Edit snippets/external.ts and save. You will probably see it reflected in the slide
  5. Open slide 2 in browser
  6. Edit snippets/second.ts and save. This reproduces the problem for me.

I think @pasdam's comment is crucial - multiple snippets enable / make it easier to hit the problem.

kubukoz avatar Nov 17 '25 15:11 kubukoz