-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add a helper to enable hot-reloading of the preview-frame. #202
Conversation
0a8b77a
to
f30bc95
Compare
Can you explain what this is doing? What is "on:hot-reload" and when will that trigger? |
When using |
Thanks, that makes sense and sounds very helpful.
…On Fri, Jan 20, 2023 at 12:31 PM Tom Prince ***@***.***> wrote:
Can you explain what this is doing? What is "on:hot-reload" and when will
that trigger?
When using npm run dev, that runs a local web server that serves the app.
That server is intended for being used while editing the app, so it has
some features to make that process smoother. In particular, when you make a
change to a file (and *save* it), the server notices that and tells the
browser to update that bit of code. The easiest way would be to just
refresh that page, but that is more disruptive than necessary a lot of the
time. In practice, what happens is that when a component is updated, just
that component is recreated (see here
<https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#whats-hmr-by-the-way>
for a discussion of some of the details). That doesn't work for the preview
frame, as it will just be empty. This adds some hooks for adding to that
behaviour. In particular, after the preview frame is recreated, we now
update the preview.
—
Reply to this email directly, view it on GitHub
<#202 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKUHWTMBFWTYPNKCEWSDUG3WTLKXTANCNFSM6AAAAAAT5OIV4Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
220063a
to
312b160
Compare
I also added in a cleanup of an unused variable that was accidentally left in #157. |
This was unintentionally left in spirit-island-builder#157 from a previous version.
312b160
to
02fb16c
Compare
This uses undocumented hook mentioned in sveltejs/svelte-hmr#57 to automatically update the
preview frame, when the preview frame gets reloaded.