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 ef0e2c6 commit 2aa2e3e
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 2aa2e3e

Please sign in to comment.