eleven / ocho Public

mac: hard-load the page so a relaunch never runs stale web code (#88)

WKWebView's subresource cache can hang on to /static/*.js past the
server's no-cache, so a relaunched app could keep running old chat.js
against a redeployed server. Load with reloadIgnoringLocalAndRemoteCacheData
(a browser shift-reload); the assets are small.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell df93079ece50ce93a06e66a6adf8c11ebc221ca7 parent 01b2298
1 file changed, +5 −1
  • ios/LChatMac/ChatFeedWebView.swift +5 −1
diff --git a/ios/LChatMac/ChatFeedWebView.swift b/ios/LChatMac/ChatFeedWebView.swift
index 655d55c..1f91d97 100644
--- a/ios/LChatMac/ChatFeedWebView.swift
+++ b/ios/LChatMac/ChatFeedWebView.swift
@@ -64,7 +64,11 @@ struct ChatFeedWebView: NSViewRepresentable {
if #available(macOS 13.3, *) { web.isInspectable = true }
#endif
if let start = chat.origin ?? URL(string: chat.url) {
- web.load(URLRequest(url: start))
+ // Hard load (like a browser shift-reload): WKWebView's subresource
+ // cache can hang on to /static/*.js past the server's no-cache, so a
+ // relaunch could keep running week-old app code against a redeployed
+ // server. The assets are small; always fetch them fresh at launch.
+ web.load(URLRequest(url: start, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData))
}
return web
}