Update fetch for static page gen, fix DOM patching

This commit is contained in:
2026-07-13 09:51:32 -04:00
parent 9662f83319
commit ea3d2a6d03
10 changed files with 305 additions and 13 deletions

View File

@@ -8,8 +8,17 @@ import (
"strings"
"sync"
"syscall/js"
"kjol/httputil"
)
// Installing the transport here (rather than leaving it to each app's main)
// keeps httputil's invariant true by construction: FetchGob / FetchJSON have a
// transport exactly when they are running in the browser. That is what lets them
// no-op during SSR instead of reporting a failure. Apps that need custom headers
// or a base URL can wrap FetchBytes with httputil.SetClientTransport at startup.
func init() { httputil.SetClientTransport(FetchBytes) }
// absURL resolves a relative path against the current origin (a browser resolves
// relative fetch URLs itself, but building the absolute URL keeps behavior
// uniform — and lets non-browser hosts, e.g. tests, fetch too).