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

Fix profile page pull to refresh #129

Merged
merged 2 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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