go-app: Update of wasm binary doesn't trigger update of cached app
So here is very simple scenario
There is a message in main function
fmt.Println("Launching wasm app")
it’s compiled and loaded, message appears in console.
Now change it to
fmt.Println("Launching wasm app 1")
Put cursor in address bar, press enter - nothing happens. Then press Ctrl-F5 (force reload), new message appears.
Then try pressing Ctrl-R (regular reload), old message will come back, same if you put cursor in address bar and press enter - old message is there.
Tested in latest Firefox and Chrome on desktop.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 29 (17 by maintainers)
Sorry to dominate this issue with tangential topics, but I’m enjoying the conversation and selfishly continuing - feel free to minimize. 😃
@oderwat For context, the UI I’m building is a CI/CD build view, which is powered by OpenTelemetry traces + logs under the hood. Here’s a screenshot of the current React version. Up until now we’ve been sending all the OpenTelemetry data to the client to process and render. It’s “fine” for small/medium traces, but it’s highly variable: our full integration test suite generates ~200MB of just trace data, not even including logs. 😱
We’ve been able to kick the can down the road on this in React, since the only real bottleneck is the network. It’s still not OK, since not everyone has fast internet, but the loose coupling has let us quickly iterate on the UI. With WebAssembly we’re forced to solve this sooner as the constraints are harsher, but it’s for the best.
So, fully agreed that processing 200MB client-side is not OK. That’s already fixed in my Go-App version, essentially as you described, via server-side processing and sending only visible data via WebSockets as the user expands/collapses spans in the UI. Now memory usage is under control, and the app is snappy. I only brought it up as an example where the caching behavior can be cumbersome while you iterate towards that. It’s a very complicated optimization to implement (with more work still to be done), so I was focusing on other risk factors first.
Haha, yep ran into this already; my app was OOMing in Firefox, but fine in Chrome, but sometimes fine in Firefox depending on… well, I don’t even know. It seems pretty easy for allocations to outpace the GC when you’re hurling 200MB+ of data around.
Understood, sorry for the distraction here, it was a poorly made point while rushing out the door. I don’t expect a magical live updating experience. I just don’t want it to cache the app so aggressively during development so I can do simple things like open links in new tabs without having to hard-refresh or restart the server all the time (assuming something is rebuilding
app.wasmon code change). If that means throwing out the PWA aspect during development, so be it!I think Go-App is a more appropriate choice for my use case than the other options; it’s much closer to a full blown interactive app than a vanilla CRUD website. I don’t really care about offline mode, so it may seem like an odd choice if that’s the initial purpose for Go-App existing, but there’s a lot more to Go-App than that. Specifically, I like Go-App’s rendering + components model, and the fact that I can try all sorts of optimizations, which will be important for users sifting through large traces.
I’ve used HTMX + Templ in the past for Daggerverse and so far I like Go-App more; it’s a much easier transition from React, especially for interactive apps.
Happy to try PRing this sometime!
I dealt with this with a wrapper which periodically checks the modification / hash (and a
sync.RWMutex, as you say, @inliquid)https://gist.github.com/tiedotguy/b8a29519c4690b45f89c003a37e36402
It’s a bit more complicated in reality 'cause I’ve got some fsnotify junk in there, but I don’t like that code, and it doesn’t contribute anything, so I’ve stripped it.