Stable server fn endpoints: open tabs survive deploys
Deploy / deploy (push) Successful in 1m3s

The 'previous question's resources until refresh' mystery: leptos's
auto-generated server fn routes embed a hash that changes across
builds. Every deploy therefore breaks every already-open tab - its
wasm keeps calling /api/get_question<oldhash>, the new server answers
400 'Could not find a server function at the route', and client-side
navigation quietly leaves the previous question's data on screen.
Refresh loads the new wasm with matching hashes, which is why it
always fixed it. Confirmed live: a pre-deploy client 400ed on
get_question2970801986613442004 while the freshly served wasm calls
get_question13103328088426240960, same source on both builds.

Explicit endpoint names decouple the URL from the build. This deploy
is the last breaking one; after it, old clients keep working.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bendik Aagaard Lynghaug
2026-08-15 12:18:15 +02:00
co-authored by Claude Fable 5
parent 5b3ffa62e8
commit c9c5caf3ff
5 changed files with 19 additions and 9 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ use leptos::prelude::*;
/// fetch (`GiteaStarred`/`GiteaOrgRepos`/`Url`), the mechanism behind
/// "a resource parameterized by other form fields"; a `Kv` resource
/// ignores them entirely, same as today.
#[server]
#[server(endpoint = "get_resource")]
pub async fn get_resource(
question_id: String,
alternative: String,
@@ -49,7 +49,7 @@ pub async fn get_resource(
/// of whether it's displayed read-only or offered as choices to pick
/// from, so this deliberately doesn't duplicate the source-dispatch or
/// jq-shaping logic - see `fetch_resource_value`.
#[server]
#[server(endpoint = "get_requirement_options")]
pub async fn get_requirement_options(
question_id: String,
alternative: String,
@@ -80,7 +80,7 @@ pub async fn get_requirement_options(
/// `get_requirement_options`: fetches the resource a bound field
/// loads its value from, parameterized by the watched sibling's value
/// (already inside `params`, keyed by the bind's param name).
#[server]
#[server(endpoint = "get_requirement_binding")]
pub async fn get_requirement_binding(
question_id: String,
alternative: String,