[ Feat : The "Add" and "Remove" following options implemented ] #1181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The
isUserFollower
andaddUserFollower
andremoveUserFollower
which was already present as redux actions, I used it as onClick's function in the fixedData of HomePage ( contributors and who to follow section), and as these functions take two paramscurrentProfile
in which the logged in user i.e. Codelabz profile is sent here and the 'profile to follow' in which for the time being I have sent a fixed data of another codelabz account ofsaogatariju
.Related Issue
Fixes #1177
Motivation and Context
To make things work and smooth like butter.
How Has This Been Tested?
Tested Locally on my machine.
Workings explained:
In first video, Here the
follower count
andfollowing count
for the two users in actions is not updated but just creating or updating the user_followers collection so there is no re render of page as theprofileData
in HomePage is not updating.Codelabz.-.Google.Chrome.2024-02-11.22-11-47.mp4
While, in second video, the
follower count
andfollowing count
in profile actions is updated i.e. profileData is getting changed and the normal react comparison is so shallow that it's treating them differently causing the page re render and to avoid it I will be doing memoization in another issue or PR - just for the sake of clean code. And, I would like to think it's changing because of props comparison and if not then memo won't work, so will make a different issue for it.Codelabz.-.Google.Chrome.2024-02-11.22-09-53.mp4
Here every user is getting changed on one user click because I have sent the same profile data for each one of them and i.e. of
saogatariju uid
. Check the codeTypes of changes
Checklist:
Additional:
If want to see the first video changes then just comment out the update doc part in
addUserFollower
andremoveUserFollower
actions.