maxence-charriere / go-app

A package to build progressive web apps with Go programming language and WebAssembly.
https://go-app.dev
MIT License
7.75k stars 354 forks source link

Hot Reload #950

Closed sw1pr0g closed 1 month ago

sw1pr0g commented 1 month ago

Hi here! Is hot reload avaliable in development with this package?

oderwat commented 1 month ago

This is not build in and would be hard to do universally I guess.

We use auto-reload for our projects using a build stage tool that knows about all dependencies including "go.work" files and watches the file system for changes. Since "v10" it uses an event-source based mechanism to reload the PWA for quick responses. But to load into the previous state of the application you need to implement a mechanism for this in your frontend by yourself. If you implement routes (we use more of a view context) and store the state of the app in the local storage, you can reload into this state, because you get to decide what you do before the reload for updating the app.

Make sure you understand how a PWA gets updated (see: https://go-app.dev/lifecycle)

sw1pr0g commented 1 month ago

thank you @oderwat