lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.88k stars 86 forks source link

HMR doesn't detect new _data.yml when remote file is specified #633

Closed wjharney closed 3 months ago

wjharney commented 3 months ago

Version

v2.2.2

Platform

macOS

What steps will reproduce the bug?

The expected behavior of HMR is that creating, updating, or deleting any file will result in changes being reflected in the browser without needing to refresh the page or restart the server. However, when creating or deleting a _data.yml file that has an associated remote file, the expected changes are not seen unless the server is restarted.

Steps to reproduce

  1. Clone this gist: https://gist.github.com/wjharney/d73914e8e74b77bc3a99e938af33bce9
  2. Run deno task serve to start the server.
  3. Visit http://localhost:3000/posts/hello-world/ to see the post, with the heading "Base Template".
  4. While the server is running, run echo 'layout: layouts/replacement.vto' > posts/_data.yml to change the layout used for the post.
  5. Refresh the page.

Expected Result: The heading should be "Replacement Template".

Actual Result: The heading is "Base Template".

  1. Stop and restart the server. The post now uses the correct template, with the heading "Replacement Template".
  2. Delete posts/_data.yml.
  3. Refresh the page.

Expected Result: The heading should be "Base Template".

Actual Result: Neither template is used; the page only contains the post content, "Hello World".

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

The page should be updated without needing to reload the page or restart the server.

What do you see instead?

The changes aren't reflected unless the server is restarted.

Additional information

oscarotero commented 3 months ago

Indeed, that's a bug. I'm investigating the best way to fix it. Will be fixed in the next version of Lume. Thanks!

oscarotero commented 3 months ago

I just uploaded a fix. If you want to test it, you can upgrade Lume to the latest development version deno task lume upgrade --dev. It will be available in the next stable version (v2.2.4)