Skip to content

Commit

Permalink
fix: Wait for community data in registerUsernameSaga (#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
leblowl committed Apr 15, 2024
1 parent 8801593 commit 31a3016
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { identitySelectors } from '../identity.selectors'
import { identityActions } from '../identity.slice'
import { config } from '../../users/const/certFieldTypes'
import { Socket } from '../../../types'
import { communitiesActions } from '../../communities/communities.slice'
import { communitiesSelectors } from '../../communities/communities.selectors'
import { CreateUserCsrPayload, RegisterCertificatePayload, Community } from '@quiet/types'

Expand All @@ -16,7 +17,13 @@ export function* registerUsernameSaga(

const { nickname, isUsernameTaken = false } = action.payload

const community = yield* select(communitiesSelectors.currentCommunity)
let community = yield* select(communitiesSelectors.currentCommunity)

if (!community) {
yield* take(communitiesActions.addNewCommunity)
}

community = yield* select(communitiesSelectors.currentCommunity)

if (!community) {
console.error('Could not register username, no community data')
Expand Down

0 comments on commit 31a3016

Please sign in to comment.