-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Remove zero star rating #275
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
Conversation
- Removed unnecessary post update in MapView - Updated onRatingChanged passed to PostItem mappings in Feed and MapView to ensure correctness of rating averages
…ter update - Updated the selected post of the viewmodel to ensure the mapview's selectedPost value is set to the updated post. This allows MapView to maintain continuous updates of the parameters in the image preview dialog. - Removed unnecessary launched effect
… view - Updated PostItem to display ratings only if wanted - Refactored GoogleMap and MapView so that ratings don't display when selecting a post - Made ImagePreviewDialog deny the display of ratings
- Replaced testStarIsDisplayed with testStarIsNotDisplay - Commented out testStarClickClassUdpatePost as it isn't meaningful anymore
…and FeedScreen - Moved rating logic and concurrency-safe updates (Firestore transactions) into PostsViewModel. - Removed direct rating calculations from FeedScreen, relying instead on ViewModel’s state and methods. - Initialize and observe post ratings and user profiles in the ViewModel to ensure a single source of truth. - Improved performance and stability by avoiding repeated rating initializations and ensuring atomic updates. - Enhanced code maintainability and reduced UI complexity by centralizing business logic in the ViewModel.
|
rihabbelmekki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great code! The changes correctly fix the rating state inconsistency issues by:
Removing the separate state management functions and bringing the logic back inline
Improving the profile state handling to ensure ratings are properly reinitialized when navigating back to the feed
Adding proper profile loading checks before initializing ratings
The code is now more robust and maintains consistent state across navigation. Tested and confirmed that ratings persist correctly when navigating between screens. Good to merge!



This pull request solves issue #209
Note: Drafted due to a bug that may necessitate significant changes in the Google Maps implementation.