From a29c025a853fed9484094040f9d5133c10260d04 Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Wed, 12 Aug 2026 16:53:12 +0200 Subject: [PATCH] get_resource/get_requirement_options: #[server(default)] on params An empty params map serializes to no `params` key at all on a real client-side call, so every Resource::refetch() after an empty-params fetch failed with "missing field params" - only ever masked before because a resource's *first* load is always server-resolved during SSR, never round-tripping through serialization at all. Surfaced by the new shared batch-confirm button's post-confirm refetch, but this already affected the old per-row confirm's refetch identically - pre-existing, not new. Co-Authored-By: Claude Sonnet 5 --- src/resource.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/resource.rs b/src/resource.rs index a25881b..2bbfafc 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -21,6 +21,13 @@ pub async fn get_resource( question_id: String, alternative: String, feature_name: String, + // An empty map serializes as no `params` key at all on a real + // client-side call (unlike the server-only initial SSR call, which + // never round-trips through serialization) - without this, every + // `Resource::refetch()` after a fully-empty-params call failed with + // "missing field `params`", even though the very first load (always + // server-resolved) never did. + #[server(default)] params: std::collections::HashMap, ) -> Result { use crate::server::AppState; @@ -48,6 +55,8 @@ pub async fn get_requirement_options( alternative: String, feature_name: String, requirement_name: String, + // See get_resource's `params` for why this is needed. + #[server(default)] params: std::collections::HashMap, ) -> Result { use crate::server::AppState;