You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been test running 2.0.0-canary-10 for a few weeks now on my blog. So far, I'm a BIG fan of the new reload behavior! It makes authoring a much more pleasant experience and is so much faster. That said, I did notice a bug where the hot reload breaks and elements inserted into the page with JavaScript disappear once the hot reload occurs.
Suppose you have this index.html in an absolute bare-minimum 11ty project with nothing else:
<p>I love <spanid="test"></span></p><script>document.getElementById('test').innerText='11ty';</script>
On an initial page load or a manual reload, it works as expected: The user sees I love 11ty.
If you later edit the file and save it to trigger a rebuild, though, the page reloads and the JavaScript breaks. Now, you only see I love.
Navigate to localhost:8080. Observe the page reads: I love 11ty.
Open, edit, and save src/index.html.
Observe that the server hot-reloads the page.
Observe that the paragraph now reads I love.
Expected behavior
This is somewhat expected because the page didn't actually reload, so the JavaScript doesn't re-run. On the other hand, if the page isn't actually reloading, elements previously inserted by JavaScript should be preserved. It can be a little annoying if you're writing JavaScript and want to see the results since you need to reload the page manually on each refresh. However, so far this has only been a minor annoyance for me.
Screenshots
N/A
Environment:
OS and Version: N/A (Windows 10 build 19044,1706, running 11ty in WSL 2)
Eleventy Version: 2.0.0-canary-11 (also reproducible in 10)
The text was updated successfully, but these errors were encountered:
Describe the bug
I've been test running 2.0.0-canary-10 for a few weeks now on my blog. So far, I'm a BIG fan of the new reload behavior! It makes authoring a much more pleasant experience and is so much faster. That said, I did notice a bug where the hot reload breaks and elements inserted into the page with JavaScript disappear once the hot reload occurs.
Suppose you have this
index.html
in an absolute bare-minimum 11ty project with nothing else:On an initial page load or a manual reload, it works as expected: The user sees
I love 11ty
.If you later edit the file and save it to trigger a rebuild, though, the page reloads and the JavaScript breaks. Now, you only see
I love
.To Reproduce
Steps to reproduce the behavior:
yarn
to install dependencies.yarn serve
to start the dev server.I love 11ty
.src/index.html
.I love
.Expected behavior
This is somewhat expected because the page didn't actually reload, so the JavaScript doesn't re-run. On the other hand, if the page isn't actually reloading, elements previously inserted by JavaScript should be preserved. It can be a little annoying if you're writing JavaScript and want to see the results since you need to reload the page manually on each refresh. However, so far this has only been a minor annoyance for me.
Screenshots
N/A
Environment:
The text was updated successfully, but these errors were encountered: