Overview
TheuseInvites composable provides reactive access to all pending invitations and friend requests. It aggregates data from the matchmaking store and provides computed properties for checking invite states and counts.
Usage
Return Values
The composable returns an object with the following reactive computed properties:Invite Collections
Array of pending match invitations from the matchmaking store.
Array of pending lobby invitations from the matchmaking store.
Array of pending friend requests that were not sent by the current user. Filtered to show only incoming friend requests and sorted alphabetically by name.
Status Checks
Whether there are any pending match invites. Returns
true if matchInvites has one or more items.Whether there are any pending lobby invites. Returns
true if lobbyInvites has one or more items.Whether there are any pending incoming friend requests. Returns
true if pendingFriends has one or more items.Whether there are any invites of any type (match, lobby, or friend requests). Returns
true if any of the above categories have items.Whether there are match invites or friend requests (excludes lobby invites). Useful for social-specific notification indicators.
Counts
The total number of pending invites across all categories (match + lobby + friend requests).
Use Cases
Notification Badges
Display count badges on navigation items or buttons to indicate pending invites.
Invite Panels
Render invite lists with conditional visibility based on invite presence.
Social Features
Manage friend requests and social interactions within the platform.
Matchmaking UI
Show pending match and lobby invitations for quick joining.
Example: Notification Badge
Example: Invites Panel
Example: Social-Only Notifications
Friend Request Filtering
ThependingFriends property automatically filters the friends list to show only:
- Friends with status
"Pending" - Friend requests where the current user is NOT the inviter (incoming requests only)
Dependencies
useMatchmakingStore()- Provides match invites, lobby invites, and friends listuseAuthStore()- Provides current user information for filtering friend requests
Notes
All returned values are computed properties that automatically update when the underlying store data changes. No manual refresh is needed.
The
pendingFriends list is automatically sorted alphabetically by name for consistent display ordering.