Context
Relevant issue: https://github.com/cssbruno/GoWDK/issues/502
Assumptions
- This PR completes the bounded
fetchJSON[T](urlExpr)form for client islands. g:await,g:async, arbitrary promises, and value-returning async helpers remain out of scope.
Proposed Changes
- Add an
AwaitBlockview node and parser support for{#await}branches. - Render await blocks as
gowdk-awaitmarkers with pending/then/catch templates inside JS islands. - Add runtime fetch execution, cancellation, branch swapping, and re-binding.
- Update diagnostics and language docs to describe the supported slice.
Files Expected To Change
internal/viewmodel/internal/viewparse/internal/viewrender/internal/clientlang/internal/clientrt/assets/island.jsdocs/language/- focused tests under
internal/viewrender,internal/clientrt, andinternal/buildgenas needed.
Data And API Impact
- Adds generated
gowdk-awaitmarkup anddata-gowdk-await-*attributes inside JS islands. - Does not change Go public APIs or endpoint contracts.
Tests
- Unit: parser/model/render validation and diagnostics.
- Integration: generated runtime snippets.
- End-to-end: browser island await success/error behavior when feasible.
- Manual: none expected.
Verification Commands
go test ./internal/viewrender ./internal/clientrt ./internal/buildgen ./internal/compiler ./internal/lang
go test ./...
go build ./cmd/gowdk
Rollback Plan
- Revert the parser/model/render/runtime changes and restore the unsupported await diagnostic text.
Risks
- Nested branch content must be rebound after swaps.
- Stale fetch results must not update detached or superseded await blocks.
- Await-generated islands must mount even when a component has no explicit state or event handlers.