-
Notifications
You must be signed in to change notification settings - Fork 130
fix: competition filter not updating correctly (#148) #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: competition filter not updating correctly (#148) #149
Conversation
|
@ramith-kulal is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes convert the Filter component from uncontrolled to controlled using Zustand state management, improving state synchronization. Filter element identifiers are scoped with filterName to prevent conflicts. The FilterInputState type is clarified from generic Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)apps/web/src/components/ui/Filter.tsx (1)
🔇 Additional comments (5)
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 |
Description
This pull request fixes the issue where changing the Competition filter affected the Popularity filter instead of updating its own state.
The bug occurred because a new local object was being created on each render, overwriting previous filter selections.
Changes Made
Removed unnecessary local inputData object inside the Filter component
Used updateFilters({ [filterName]: filter }) to correctly merge filter states
Made the RadioGroup controlled via Zustand state (value + onValueChange)
Ensured each filter (Popularity, Competition, Tech Stack, etc.) updates independently
🧪 Tested Behavior
Selecting different filters now correctly updates their respective categories
No interference between Competition and Popularity filters
Verified persistent selection state across multiple filter groups
🖥️ Issue Reference
Fixes: #148
Summary by CodeRabbit