Subject: Implementing Suspense-like loading patterns with Convex useQuery
I'm trying to implement a UX pattern where users can click on a tab that needs data, but instead of seeing a loading state, they see content from another tab while the data loads in the background. Once ready, it automatically transitions to the requested tab.
Current Implementation:
The Problem:
Convex's
useQuery returns undefined while loading, which means I can't use React's Suspense boundary effectively. The component shows loading skeletons instead of the fallback content.Questions:
1. Does Convex support a suspense mode where queries automatically suspend and work with React's
Suspense boundary?2. Is there a recommended pattern for implementing this "show fallback content while loading" behavior with Convex?
What I'm trying to achieve:
- User clicks "Activity" tab
- Immediately see "Wallet" tab content (no loading state)
- Activity data loads in background
- Automatically switch to Activity tab when ready
This is a common UX pattern in modern apps, but I'm struggling to implement it cleanly with Convex's current API.
Thanks for your help!
