fix(ui): prevent redundant achievement unlocked dialogs#2
Conversation
This commit fixes a bug where the 'Achievement Unlocked' dialog would appear repeatedly on the progress page. Changes: - Implements `localStorage` check to track seen achievements. - Filters `newlyUnlocked` achievements against the stored list. - Updates storage immediately upon identifying new achievements. - Prevents the dialog from showing for previously seen achievements.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes implement a fix for a recurring achievement unlock dialog issue by adding per-user localStorage filtering to track seen achievements. The progress page now reads seen achievement IDs from localStorage, filters the API response to show only genuinely new achievements, and persists the display state. Two documentation files (PRD and task checklist) outline the requirements and implementation plan. Changes
Sequence DiagramsequenceDiagram
participant Component as Progress Component
participant Storage as localStorage
participant API as API Data
Component->>Component: Component mounts with userId
Component->>API: Access data.newlyUnlocked
Component->>Storage: Read seen_achievement_ids for user
alt localStorage accessible
Storage-->>Component: Return seen IDs array
else storage unavailable
Component->>Component: Use empty array (fallback)
end
Component->>Component: Filter newlyUnlocked against seen IDs
Component->>Component: Display only truly new achievements
Component->>Storage: Update seen_achievement_ids with displayed IDs
Storage-->>Component: Write complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This commit fixes a bug where the 'Achievement Unlocked' dialog would appear repeatedly on the progress page.
Changes:
localStoragecheck to track seen achievements.newlyUnlockedachievements against the stored list.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.