get_resource/get_requirement_options: #[server(default)] on params
Deploy / deploy (push) Successful in 1m1s
Deploy / deploy (push) Successful in 1m1s
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
95ad459b24
commit
a29c025a85
@@ -21,6 +21,13 @@ pub async fn get_resource(
|
|||||||
question_id: String,
|
question_id: String,
|
||||||
alternative: String,
|
alternative: String,
|
||||||
feature_name: 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<String, String>,
|
params: std::collections::HashMap<String, String>,
|
||||||
) -> Result<serde_json::Value, ServerFnError> {
|
) -> Result<serde_json::Value, ServerFnError> {
|
||||||
use crate::server::AppState;
|
use crate::server::AppState;
|
||||||
@@ -48,6 +55,8 @@ pub async fn get_requirement_options(
|
|||||||
alternative: String,
|
alternative: String,
|
||||||
feature_name: String,
|
feature_name: String,
|
||||||
requirement_name: String,
|
requirement_name: String,
|
||||||
|
// See get_resource's `params` for why this is needed.
|
||||||
|
#[server(default)]
|
||||||
params: std::collections::HashMap<String, String>,
|
params: std::collections::HashMap<String, String>,
|
||||||
) -> Result<serde_json::Value, ServerFnError> {
|
) -> Result<serde_json::Value, ServerFnError> {
|
||||||
use crate::server::AppState;
|
use crate::server::AppState;
|
||||||
|
|||||||
Reference in New Issue
Block a user