Events Quests
Event Types Overview
Currently, there are two types of events, each with different quest handling approaches:
Normal Events
Users compete by completing one or more quests at a time
Quest submissions follow the same approach as standard quests
Score-Based Events
Quests are automatically tracked, with results defined progressively
Submissions require synchronization to fetch and process user data (e.g., scores or stats)
To explore the type definitions in detail:
Quest Submission Methods
Normal Events
Use the useMutateQuestSubmit
hook, which follows the same workflow as standard quests.
Score-Based Events
Use the useSyncEvent
hook to handle synchronization of event data.
Using useSyncEvent Hook
The useSyncEvent
hook is specifically designed for score-based events:
Implementation Example
Here's a complete example of implementing synchronization logic:
Key Features of useSyncEvent
Purpose
Syncs event data for score-based events
Ensures participant stats or scores are updated
Input Requirements
Requires the
eventId
to identify the event
Debounce Logic
Includes a 5-minute cooldown
Prevents unnecessary repeated sync attempts
UI State Management
Uses
isSyncing
state to indicate ongoing synchronizationProvides feedback about sync status to users
Best Practices
Normal Events
Handle quest submissions like standard quests
Use appropriate error handling and loading states
Score-Based Events
Implement debounce logic to prevent excessive syncs
Show clear sync status to users
Handle errors gracefully
Update UI appropriately after successful syncs
General Guidelines
Always verify event type before handling quests
Implement appropriate loading and error states
Consider user feedback for different quest states
Last updated