Subject: Implementing Suspense-like loading patterns with Convex useQuery
Hi Convex team,
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!3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Gist
React suspense with Convex
React suspense with Convex. GitHub Gist: instantly share code, notes, and snippets.
GitHub
convex-helpers/packages/convex-helpers/README.md at main · get-con...
A collection of useful code to complement the official packages. - get-convex/convex-helpers