-
Notifications
You must be signed in to change notification settings - Fork 132
Fix Audius appearing to be not followed after signup QA-678 #6564
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ import { | |
| import { call, select, takeEvery, put } from 'typed-redux-saga' | ||
|
|
||
| import { make } from 'common/store/analytics/actions' | ||
| import { adjustUserField } from 'common/store/cache/users/sagas' | ||
| import { adjustUserField, fetchUsers } from 'common/store/cache/users/sagas' | ||
| import * as signOnActions from 'common/store/pages/signon/actions' | ||
| import { profilePage } from 'utils/route' | ||
| import { waitForWrite } from 'utils/sagaHelpers' | ||
|
|
@@ -48,9 +48,19 @@ export function* followUser( | |
| } | ||
|
|
||
| const users = yield* select(getUsers, { ids: [action.userId, accountId] }) | ||
| const followedUser = users[action.userId] | ||
| let followedUser = users[action.userId] | ||
| const currentUser = users[accountId] | ||
|
|
||
| if (!followedUser) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this check if we are assuming the forked fetchDefaultUsers will run beforehand?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically no, but this is more to future proof this kind of thing in the future for different flows |
||
| try { | ||
| // If we haven't cached the followed user, need to fetch and cache it first to ensure that we have the correct `does_current_user_follow` on the user value before the follow gets indexed. | ||
| const { entries } = yield* call(fetchUsers, [action.userId]) | ||
| followedUser = entries[action.userId] | ||
| } catch (e) { | ||
| console.error('Failed to fetch the followed user', action.userId) | ||
| } | ||
| } | ||
|
|
||
| if (followedUser) { | ||
| // Increment the followed user's follower count | ||
| yield* put( | ||
|
|
||
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.
nice, so the ideas is that these are in the cache now, so when user follows them, they will be updated appropriately?
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.
yes! basically just trying to fetch the users in parallel early in the flow to speed up the follow process during sign up (and thus maximizes the chance that the follows will be complete once the users hit the feed)