Partial updates use server fragments, not full-page SSR. The generated slice supports action-driven fragment responses for SPA/action pages and standalone static fragment routes.
Current support:
Editor completions include
g:post,g:target, andg:swap.SPA builds lower
g:post={action}on<form>to normal POST form attributes for the first action slice.SPA builds parse
g:target="#id"andg:swap="innerHTML|outerHTML"ong:postforms and lower them todata-gowdk-targetanddata-gowdk-swapattributes for the client runtime.SPA builds emit
assets/gowdk/gowdk.jsand a deferred script tag only when a page uses partial form metadata with a fragment-producing action.g:targetmust reference a SPAidin the same directview {}markup subset.Action bodies parse
fragment "#id" { ... }metadata and capture the raw fragment body for generated render functions and first-slice generated action responses.Runtime/addon package boundaries exist for partial responses and swaps.
runtime/responsefragment responses carry target and swap metadata throughX-GOWDK-Fragment-TargetandX-GOWDK-Fragment-Swapwhen written to HTTP.Page files can declare standalone fragment endpoints:
fragment Patients GET "/patients/list" "#patients" { <section>Patients</section> }Generated apps register these as backend endpoints, not page route kinds. They currently require
GET, a concrete absolute path without route params, and a literal id-selector target.If the same package exports a function with the fragment name and signature
func(context.Context) (response.Response, error), generated apps call that user-owned hook at request time. The hook owns data loading, validation, redirects, HTML, JSON, and fragment response decisions throughruntime/response.Response.runtime/app.Request(ctx)exposes the current request. If no function with the fragment name exists, the generated handler serves the static rendered fragment body.Generated embedded app action handlers can respond to
X-GOWDK-Partialrequests with rendered fragment HTML,Cache-Control: no-store, and fragment target metadata. Normal POST requests still use the redirect/no-content fallback path.Generated standalone fragment handlers return no-store responses. Static fallback fragments return rendered HTML,
Content-Type: text/html; charset=utf-8, and fragment target/swap headers.Static standalone fragment bodies expand known components at app generation time, including page-level
usealiases and component-scoped child components. They are used only when no same-package request-time fragment hook is bound.Generated required-field validation failures on partial requests with
X-GOWDK-Targetreturn an escaped validation fragment for that target, also withCache-Control: no-store.internal/clientrtemits a smallgowdk.jsruntime that enhancesform[data-gowdk-target]submissions, sendsX-GOWDK-Partial,X-GOWDK-Target, andX-GOWDK-Swap, appliesinnerHTMLorouterHTMLswaps, dispatchesgowdk:before-request,gowdk:after-swap, andgowdk:request-error, and togglesaria-busyon the form while the request is pending. Failed enhanced requests includestatus,body, andresponsein thegowdk:request-errordetail when an HTTP response exists. It restores focus by matching the active element'sidornameafter the swap when possible. Before a swap, it calls the generated island destroy hook when present for islands being replaced; after the swap, it calls the generated island mount hook so newly inserted JavaScript islands can attach.
Swap Modes
The current swap modes are:
innerHTML: replace the target element children with the returned fragment HTML. The target element itself remains in place.outerHTML: replace the target element itself with the returned fragment HTML.
Build output records these values as data-gowdk-swap metadata and runtime
fragment responses expose the same mode names through response metadata. The
first client runtime prefers the response X-GOWDK-Fragment-Swap header and
falls back to the form metadata.
Field-specific generated validation messages are documented in
docs/language/actions.md. The form enhancement contract is documented in
forms.md.