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:
co-authored by
Claude Fable 5
parent
5b3ffa62e8
commit
c9c5caf3ff
+3
-3
@@ -1484,7 +1484,7 @@ fn NotFound() -> impl IntoView {
|
||||
}
|
||||
}
|
||||
|
||||
#[server]
|
||||
#[server(endpoint = "get_question")]
|
||||
pub async fn get_question(path: String) -> Result<Option<Question>, ServerFnError> {
|
||||
use crate::server::AppState;
|
||||
let state = expect_context::<AppState>();
|
||||
@@ -1495,7 +1495,7 @@ pub async fn get_question(path: String) -> Result<Option<Question>, ServerFnErro
|
||||
/// the site nav's data. Context-dependent: an owner session sees the
|
||||
/// gated pages too, and `followup` pages only appear once the visitor
|
||||
/// carries an answer chain.
|
||||
#[server]
|
||||
#[server(endpoint = "list_qualifying_questions")]
|
||||
pub async fn list_qualifying_questions(
|
||||
has_chain: bool,
|
||||
) -> Result<Vec<(String, String)>, ServerFnError> {
|
||||
@@ -1528,7 +1528,7 @@ pub struct SubmitResult {
|
||||
pub chain_hash: String,
|
||||
}
|
||||
|
||||
#[server]
|
||||
#[server(endpoint = "submit_answer")]
|
||||
pub async fn submit_answer(
|
||||
question_id: String,
|
||||
alternative: String,
|
||||
|
||||
Reference in New Issue
Block a user