Loader invalidation
Refresh stale #[load] data after mutations by re-running loaders or invalidating cached responses.
LIVE
invalidate()
Server stamp via #[server] — invalidate SPA prefetch cache, then refresh.
Stamp:
Short cache TTL
#[load(cache = "public, max-age=10")]
async fn product_list(_req: &FlowRequest) -> Vec<Product> {
db::products().await
}Private per-user data
#[load(cache = "private, no-store")]
async fn cart(req: &FlowRequest) -> Cart {
cart_for(req.user_id()).await
}Same page, new query (SPA)
Filters and date pickers on one route (e.g. /reservar?fecha=) should call __resuma.navigate or use loader_refresh_input — see Query params.
After submit: full page navigation
The simplest invalidation — redirect to GET (see PRG pattern). The next SSR run re-executes all loaders.
set_load_cache (runtime)
// After successful mutation in #[server] or enhanced submit client path:
set_load_cache("product_list", "public, max-age=0");SPA invalidation (1.0+)
Re-fetch the current page or a linked route without a full reload:
// Rust (Flow helpers):
invalidate_href("/docs");
invalidate_href_now("/docs");
invalidate_link(nav_anchor_element);
// Client (after mutation in js!):
await __resuma.invalidate();FlowExtensions for DB
Use FlowApp::with_extension("db", "ready") so loaders know the pool is initialized. See Integrations.