FAQ Common gpui-query questions answered: differences from TanStack Query, QueryClient setup, QuerySignal cancellation, persistence, and pagination. Common questions about gpui-query, grouped by topic. Getting Started How is gpui-query different from TanStack Query? gpui-query adapts TanStack Query's patterns to Rust and the GPUI framework. It uses Rust's type system for compile-time guarantees, Arc for cooperative cancellation, and integrates directly with GPUI's render loop. Can I use gpui-query outside of Zed? gpui-query is designed for the GPUI framework, which powers the Zed editor. While architecturally the Core layer is framework-agnostic, the Hook layer depends on GPUI's reactive primitives. How do I set up QueryClient in my app? Create a QueryClient instance and register it in your GPUI application. The client manages all query resources, caching, and garbage collection. See the Getting Started guide for a complete walkthrough. Architecture Why does use_query return a tuple instead of an object? use_query returns (Entity>, Subscription). Read data and status from the resource entity during render, and store the Subscription to keep the observation alive: dropping it stops updates, which is GPUI's standard lifecycle convention. What happens if my component unmounts during a fetch? gpui-query uses cooperative cancellation via QuerySignal (Arc). When a component unmounts, the signal is set and the query checks it between retry attempts, which keeps teardown clean. What is QuerySignal and when do I check it? QuerySignal is an Arc that enables cooperative cancellation. Long-running queries should check the signal periodically (especially between retry attempts) and abort early if cancelled. Advanced Why does LatestWins cancel my in-flight request? LatestWins is a RequestPolicy that ensures only the most recent request's result is used. When a new request arrives, previous in-flight requests are cancelled via their signals, which prevents stale data from overwriting fresh results. How do I persist my query cache? Enable the persist feature and implement the async Persister trait to save and restore query state across restarts. gpui-query supports custom backends (files, databases, KV) and ships a ready-made disk adapter in the gpui-query-persist crate. How do I handle pagination? Use use_infinite_query for paginated data. It supports bidirectional fetching (fetch_next_page_infinite / fetch_previous_page_infinite) and configurable max_pages to limit cached pages. Is there a devtools experience? gpui-query provides ClientDiagnostic types for inspecting cache state, query status, and resource lifecycle, a developer toolkit for debugging async state.