-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fixed Follow Button Of CurrentUser #531
Fixed Follow Button Of CurrentUser #531
Conversation
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.
Hi @rahul31124, this task would require you to refactor every usage of follow button and hoist its state properly, please use view-models in high level components only. This for reasons already explained in review comment.
@@ -838,9 +841,11 @@ private fun FollowersCard( | |||
} | |||
} | |||
Spacer(modifier = Modifier.height(10.dp)) | |||
val dashboardViewModel: DashBoardViewModel = hiltViewModel() |
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.
Injecting view-models into low level components hinders our ability to test and render previews because previews cannot instantiate view-models. You would probably need to get this view-model from a high level component (its usage site) and then hoist the isSelf
state from there.
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.
@07jasjeet Hi Sir,I have implemented the State Hoist. Could you please check if everything looks good?
Hi, I've pushed some changes to make things correct. Please go through the changes to derive knowledge of the codebase. Primarily, I want to focus change where I removed the view-model being used in a layer which is preview-able. This is a behaviour we want to achieve everytime and build towards it. |
This PR resolves two main issues in the Follow Card component:
Incorrect Text Display: The text displayed as "Followers" in both the "Followers" and "Following" sections, which caused confusion.
Follow Button Visibility Issue:
The Follow button appeared next to the user's own profile in the followers/followings list of another user
Changes Made:
Fixed Incorrect Text: The text now properly reflects whether the user is in the Followers or Following list.
The follow button will not appear next to the user's own profile in the followers/following list any other user.
Before
Follow_Issue_Before.webm
After
Follow_Issue_After.webm