Language

Data Lifecycle

GOWDK has separate build-time, request-time page, and endpoint data lanes. Generated JavaScript does not own page loading policy.

GOWDK has separate build-time, request-time page, and endpoint data lanes. Generated JavaScript does not own page loading policy.

Lane Summary

ConstructRunsOwnsCurrent contract
paths {}build timeconcrete dynamic SPA routesLiteral records only. Required for dynamic SPA pages unless the page uses request-time rendering.
build {}build timestatic page dataLiteral records plus imported or same-package no-argument Go functions.
load {}request timeSSR page dataOne same-package Load<PageID> function returns map[string]any data.
actrequest timePOST/action endpoint behaviorSame-package Go handler returns runtime/response.Response.
apirequest timeAPI endpoint behaviorSame-package Go handler returns runtime/response.Response.
fragmentrequest timepartial endpoint behaviorSame-package Go hook or static generated fragment body.

Current Rules

  • build {} data is rendered into generated static output. It must not depend on the incoming HTTP request.
  • load {} selects request-time SSR and requires the SSR addon.
  • Generated SSR calls one same-package function named Load<PageID>.
  • Supported load signatures are:
func LoadDashboard(ssr.LoadContext) map[string]any
func LoadDashboard(ssr.LoadContext) (map[string]any, error)
  • One load {} block can declare multiple fields. They come from the single returned map, including dotted paths such as user.name.
  • Layouts do not have independent load {} data yet. Request-time layout data composition is planned.
  • Load redirects use ssr.RedirectTo("/path") or ssr.Redirect("/path", status). Redirect targets must be local absolute paths.
  • Not-found, forbidden, validation, and typed expected-error helpers for load are planned. Today, guards handle guarded access and other load errors use the generated SSR error-page path.
  • Generated load data is map-based today. Typed load data accessors are planned after the load result contract is stable.

Invalidation And Refresh

  • Full POST actions and enhanced POST actions share the same user Go handler ownership. The handler response decides redirect, HTML, JSON, or fragment behavior.
  • GOWDK does not automatically rerun load {} after an action today.
  • Partial updates use explicit fragment responses or standalone fragment endpoints. Fragments own their request-time data through the fragment Go hook.
  • Fragments do not declare compiler-tracked data dependencies today.
  • Generated client navigation does not prefetch or reuse load {} data today. Any future prefetch or reuse must be an explicit generated-client feature, not hidden browser-owned loading policy.

Boundaries

  • User Go owns auth, business validation, storage, service calls, and response semantics.
  • Generated Go owns adapter glue: decode, dispatch, context metadata, response writing, guards, CSRF checks, panic boundaries, and cache defaults.
  • Generated JavaScript may enhance form submissions, fragments, islands, and static SPA navigation. It must not become the authority for routes, auth, validation, server data, action behavior, cache, or page loading policy.
  • Actions do not invalidate load {} data implicitly. Use redirects, fragments, JSON, or response.ReloadPage() to make the lifecycle visible in the action result.