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

Commit

Permalink
Remove duplicate create user bank on sign up (#1868)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson committed Sep 8, 2022
1 parent 7ec8f17 commit 643cbc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions packages/web/src/common/store/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function* recordIPIfNotRecent(handle) {

// Tasks to be run on account successfully fetched, e.g.
// recording metrics, setting user data
function* onFetchAccount(account) {
function* onFetchAccount(account, isSignUp = false) {
const audiusBackendInstance = yield getContext('audiusBackendInstance')
const isNativeMobile = yield getContext('isNativeMobile')
if (account && account.handle) {
Expand Down Expand Up @@ -127,7 +127,9 @@ function* onFetchAccount(account) {
yield fork(addPlaylistsNotInLibrary)

const feePayerOverride = yield select(getFeePayer)
yield call(createUserBankIfNeeded, feePayerOverride)
if (!isSignUp) {
yield call(createUserBankIfNeeded, feePayerOverride)
}

// Repair users from flare-101 that were impacted and lost connected wallets
// TODO: this should be removed after sufficient time has passed or users have gotten
Expand Down Expand Up @@ -172,16 +174,12 @@ function* onFetchAccount(account) {
}
}

export function* fetchAccountAsync(action) {
export function* fetchAccountAsync({ fromSource = false, isSignUp = false }) {
const audiusBackendInstance = yield getContext('audiusBackendInstance')
const remoteConfigInstance = yield getContext('remoteConfigInstance')
const localStorage = yield getContext('localStorage')
const isNativeMobile = yield getContext('isNativeMobile')

let fromSource = false
if (action) {
fromSource = action.fromSource
}
yield put(accountActions.fetchAccountRequested())

if (!fromSource) {
Expand Down Expand Up @@ -258,7 +256,7 @@ export function* fetchAccountAsync(action) {

// Cache the account and fire the onFetch callback. We're done.
yield call(cacheAccount, account)
yield call(onFetchAccount, account)
yield call(onFetchAccount, account, isSignUp)
}

function* cacheAccount(account) {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/common/store/pages/signon/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ function* signUp() {
},
function* () {
yield put(signOnActions.signUpSucceeded())
yield call(fetchAccountAsync)
yield call(fetchAccountAsync, { isSignUp: true })
},
function* ({ timeout }) {
if (timeout) {
Expand Down

0 comments on commit 643cbc5

Please sign in to comment.