denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.23k stars 623 forks source link

Hot reload for islands #316

Open notangelmario opened 2 years ago

notangelmario commented 2 years ago

Is fresh capable of hot reloading while in dev mode? If not, would it be possible?

fulsomenko commented 2 years ago

If by hot reloading you mean the changes appear in your browser when you save a file. Then yes.

notangelmario commented 2 years ago

yes i noticed. but I mean could the framework only refresh the component that needs to be updated? this is considered it is used with preact

lucacasonato commented 2 years ago

It is not capable of doing this now. It may be possible that we can support this for islands in the future, but Fresh will never support this for generic pages, as there is no infrastructure for rendering pages on the client (pages are always server side rendered).

notangelmario commented 2 years ago

well yes, I would not expect hot reloading for prerendered content. but it would be nice for islands

zoeleu commented 2 years ago

This would be possible by injecting a WebSocket script, and telling the browser to refresh with every change. This would be pretty bare bones, and doesn't maintain state, but hey, it would be a start.

lucacasonato commented 2 years ago

This would be possible by injecting a WebSocket script, and telling the browser to refresh with every change. This would be pretty bare bones, and doesn't maintain state, but hey, it would be a start.

It already does this :)

zoeleu commented 2 years ago

Weird, it's not refreshing when I do changes.

notangelmario commented 2 years ago

i'm doing some research on how preact handles hot reloading aka preferesh. i'm working on a fix now and will open a pr soon

dector commented 2 years ago

@matteoturini

Weird, it's not refreshing when I do changes.

If you are using FF - check #694

marcelocra commented 1 year ago

(Just adding Hot Module Replacement - HMR - here to make it easy for people looking for that in Fresh. Now it will appear in GitHub issue search results.)

It already does this :)

@lucacasonato What do you mean by this? Does it maintain island state? Because if so, it is not currently working for me.

jiawei397 commented 1 year ago

i'm doing some research on how preact handles hot reloading aka preferesh. i'm working on a fix now and will open a pr soon

Do you have any news now?