papegaaij opened a new pull request, #1834:
URL: https://github.com/apache/wicket/pull/1834
Draft for review: **Wicket Islands**, an experimental module
(`wicket-experimental/wicket-islands`) for embedding JavaScript framework
components in Wicket pages, React first. Wicket keeps owning pages, navigation
and layout; an island is a component with a client-side peer.
## What is in it
- **Core hook** (d1f3b29f38): a partial page update can carry named data for
client-side code, a new part of `<ajax-response>` handled by both Ajax engines.
- **Server side**: `Island<P>` (props rendered as escaped JSON, mounted by
the runtime), page-bound endpoints whose calls answer with the result plus
Wicket's partial updates, failed calls answered as invalid / expired /
forbidden, islands preserved across an ancestor's re-render, `FormIsland<T,P>`
as a real `FormComponent` (conversion, validation, feedback).
- **Page-less endpoints**: stateless, parallel, session-bound calls outside
the page lock, with authorisation, and handles that give such a call page
context without the page itself.
- **Loading**: Wicket reads a Vite manifest from the classpath; in
development mode islands load from the Vite dev server with hot reload. CSP
strict mode works, and island modules get the nonce for styles they inject.
- **Client side** (npm workspace in the module): the runtime (mount
contract, page client store, TanStack Query with invalidation), the React
adapter and a Vite plugin. No node build runs in the default Maven build.
- **Examples**, built with `-Pjs-test`:
- *Treasure Hunt* (`/treasurehunt`): page-bound calls, preserve vs.
remount, a form island, page-less high scores.
- *Task Board* (`/taskboard`): optimistic drag-and-drop that rolls back on
a stale board or a WIP limit, a Wicket `ModalDialog` with rich-text and
date-picker form islands, sanitized HTML (OWASP Java HTML Sanitizer), a
client-only filter, a chart refreshed after a move.
## Running the examples
```bash
mvn install -DskipTests -Pfast
cd wicket-examples
mvn -Pjs-test jetty:run
```
Then http://localhost:8080/treasurehunt and http://localhost:8080/taskboard.
## Tests
- Unit tests for the module (WicketTester) and the client runtime (Vitest),
QUnit for the Ajax data part.
- Selenium tests for both examples (both Ajax engines), run with `-Pjs-test
-Dwicket.selenium=true`. Like `VeilPageSeleniumTest` they do not run in CI.
- `mvn clean verify -Pjs-test` is green.
## Open questions for the committers
- **Name.** "Islands" is a working name.
- **npm under the ASF.** Publishing the runtime and adapters needs a check
with the PMC and infra.
- **Endpoint declaration style.** Registration only, or `@IslandCallable`
annotations as well; this shapes the planned TypeScript contract generation.
- **Handle store default.** Session map (needs sticky sessions) or an
encrypted token.
- **The released examples war.** The release build does not activate
`-Pjs-test`, so the war carries no JavaScript. Bundling it would need npm
registry access in the release build and the third-party licence list in the
war's `LICENSE`.
## Not built yet
Typed contracts (TypeScript generated from the Java declarations), an
`IslandTester`, store seeding, the JAX-RS integration, Vue and Angular
adapters, websocket push.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]