Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fix profile page pull to refresh (#129)
Browse files Browse the repository at this point in the history
* Fix profile page pull to refresh

* Remove logs
  • Loading branch information
raymondjacobson authored Dec 2, 2020
1 parent 7dafb01 commit e8afe94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/containers/profile-page/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ const initialState = {

const actionsMap = {
[FETCH_PROFILE](state, action) {
return {
const newState = {
...state,
handle: action.handle,
userId: action.userId,
status: action.shouldSetLoading ? Status.LOADING : state.status
}
if (action.handle) {
newState.handle = action.handle
}
if (action.userId) {
newState.userId = action.userId
}
return newState
},
[FETCH_PROFILE_SUCCEEDED](state, action) {
return {
Expand Down
6 changes: 5 additions & 1 deletion src/containers/profile-page/store/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function* fetchProfileAsync(action) {
try {
let user
if (action.handle) {
yield fork(fetchUserSocials, action.handle)
user = yield call(
fetchUserByHandle,
action.handle,
Expand All @@ -79,7 +78,12 @@ function* fetchProfileAsync(action) {
return
}
yield put(profileActions.fetchProfileSucceeded(user.handle, user.user_id))

// Fetch user socials and collections after fetching the user itself
yield fork(fetchUserSocials, action.handle)
yield fork(fetchUserCollections, user.user_id)

// Get current user notification & subscription status
const isSubscribed = yield call(
AudiusBackend.getUserSubscribed,
user.user_id
Expand Down

0 comments on commit e8afe94

Please sign in to comment.