refactor(v0): name generated interaction handlers

Expose and use InteractionHandlers in the beginner example so the normal path reads as app handlers instead of registry plumbing while preserving the integration registry API.

req: ceremony/005
This commit is contained in:
slhx agent
2026-06-12 17:40:41 +02:00
parent 0f1673834b
commit e7ff4541a7
2 changed files with 13 additions and 12 deletions
+12 -12
View File
@@ -7,7 +7,7 @@ use hemplate::Hemplate;
use hemx::{Html, IntoEffect};
use hemx_axum::{
interactions, runtime_js, runtime_js_path, sse, EffectResponse, Form, HandlerErrorContext,
HandlerFailure, InteractionRequest, IntoHandlerFailure, PageRequest, Registry,
HandlerFailure, InteractionHandlers, InteractionRequest, IntoHandlerFailure, PageRequest,
};
use hemx_v0_examples::ui;
use hemx_v0_examples::ui::{auth, counter, notifications, page_swap, todo_row, todos, wizard};
@@ -228,7 +228,7 @@ async fn interact(
State(state): State<Arc<ExampleState>>,
request: InteractionRequest,
) -> Result<EffectResponse, impl IntoResponse> {
request.dispatch_async(registry(state)).await
request.dispatch_async(handlers(state)).await
}
async fn runtime() -> impl IntoResponse {
@@ -264,7 +264,7 @@ async fn events(Query(params): Query<BTreeMap<String, String>>) -> impl IntoResp
wizard_handlers,
auth_handlers
)]
fn registry(state: Arc<ExampleState>) -> Registry {
fn handlers(state: Arc<ExampleState>) -> InteractionHandlers {
interactions(ui::BUILD_FINGERPRINT)
}
@@ -665,7 +665,7 @@ mod tests {
let counter = inspect_batch(
InteractionRequest::from(form(counter::increment, &[]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -676,7 +676,7 @@ mod tests {
let validation = inspect_batch(
InteractionRequest::from(form(todos::add_todo, &[("title", " ")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -686,7 +686,7 @@ mod tests {
let store_failure = inspect_batch(
InteractionRequest::from(form(todos::add_todo, &[("title", "fail-db")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -697,7 +697,7 @@ mod tests {
let add = inspect_batch(
InteractionRequest::from(form(todos::add_todo, &[("title", "Ship v0")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -715,7 +715,7 @@ mod tests {
todo_row::rename_todo,
&[("id", "1"), ("title", "Ship 1.0")],
))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -727,7 +727,7 @@ mod tests {
let delete = inspect_batch(
InteractionRequest::from(form(todo_row::delete_todo, &[("id", "1")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -740,7 +740,7 @@ mod tests {
let missing_delete = inspect_batch(
InteractionRequest::from(form(todo_row::delete_todo, &[("id", "99")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -749,7 +749,7 @@ mod tests {
let wizard = inspect_batch(
InteractionRequest::from(form(wizard::next_step, &[("step", "1")]))
.dispatch_async(registry(state.clone()))
.dispatch_async(handlers(state.clone()))
.await
.unwrap()
.batch,
@@ -762,7 +762,7 @@ mod tests {
auth::login,
&[("email", "demo@example.com"), ("password", "secret")],
))
.dispatch_async(registry(state))
.dispatch_async(handlers(state))
.await
.unwrap()
.batch,