TanStack Query-inspired data fetching with caching, retries, and stale-while-revalidate โ built for Zed's GPU-accelerated UI framework.
cargo add rs-query
Fetch data with automatic caching and state management
use rs_query::{QueryClient, Query, QueryKey, QueryState, spawn_query}; fn fetch_users(&mut self, cx: &mut Context<Self>) { let query = Query::new( QueryKey::new("users"), || async { api::get_users().await } ); spawn_query(cx, &self.client, &query, |this, state, cx| { match state { QueryState::Success(users) => this.users = users, QueryState::Error { error, .. } => this.error = Some(error), QueryState::Stale(users) => this.users = users, // Show while refetching _ => {} } cx.notify(); }); }
Everything you need for async data in your Zed-powered apps
One-liner async execution with automatic state management and context updates.
Show cached data instantly while fetching fresh data in the background.
Exponential backoff for transient failures with configurable retry counts.
Invalidate related queries with pattern matching on nested keys.
Stale time, cache time, retry delays, and refetch policies โ all customizable.
No JavaScript, no WASM. Native performance with GPUI's reactive model.