Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Clear LW errors on modal close #3196

Merged
merged 2 commits into from
Sep 30, 2024
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
33 changes: 32 additions & 1 deletion src/modules/thirdParty/sagas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import {
fetchThirdPartySuccess,
finishPublishAndPushChangesThirdPartyItemsSuccess,
finishPublishAndPushChangesThirdPartyItemsFailure,
publishAndPushChangesThirdPartyItemsSuccess
publishAndPushChangesThirdPartyItemsSuccess,
clearThirdPartyErrors
} from './actions'
import { mockedItem } from 'specs/item'
import { getCollection } from 'modules/collection/selectors'
Expand Down Expand Up @@ -1171,3 +1172,33 @@ describe('when handling the disabling of a third party', () => {
})
})
})

describe('when handling the closing a modal', () => {
let modalName: string

describe('and the modal is the publish collection wizard', () => {
beforeEach(() => {
modalName = 'PublishWizardCollectionModal'
})

it('should clear the third party errors', () => {
return expectSaga(thirdPartySaga, mockBuilder, mockCatalystClient)
.dispatch(closeModal(modalName))
.put(clearThirdPartyErrors())
.run({ silenceTimeout: true })
})
})

describe('and the modal is not the publish collection wizard', () => {
beforeEach(() => {
modalName = 'AnotherModalName'
})

it('should not clear the third party errors', () => {
return expectSaga(thirdPartySaga, mockBuilder, mockCatalystClient)
.dispatch(closeModal(modalName))
.not.put(clearThirdPartyErrors())
.run({ silenceTimeout: true })
})
})
})
12 changes: 10 additions & 2 deletions src/modules/thirdParty/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ChainId, Network } from '@dcl/schemas'
import { CatalystClient } from 'dcl-catalyst-client'
import { DeploymentPreparationData } from 'dcl-catalyst-client/dist/client/utils/DeploymentBuilder'
import { getChainIdByNetwork } from 'decentraland-dapps/dist/lib/eth'
import { closeModal, openModal } from 'decentraland-dapps/dist/modules/modal/actions'
import { CLOSE_MODAL, closeModal, CloseModalAction, openModal } from 'decentraland-dapps/dist/modules/modal/actions'
import { showToast } from 'decentraland-dapps/dist/modules/toast/actions'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { ContractData, ContractName, getContract } from 'decentraland-transactions'
Expand Down Expand Up @@ -87,7 +87,8 @@ import {
finishPublishAndPushChangesThirdPartyItemsSuccess,
finishPublishAndPushChangesThirdPartyItemsFailure,
FINISH_PUBLISH_AND_PUSH_CHANGES_THIRD_PARTY_ITEMS_FAILURE,
FINISH_PUBLISH_AND_PUSH_CHANGES_THIRD_PARTY_ITEMS_SUCCESS
FINISH_PUBLISH_AND_PUSH_CHANGES_THIRD_PARTY_ITEMS_SUCCESS,
clearThirdPartyErrors
} from './actions'
import { convertThirdPartyMetadataToRawMetadata, getPublishItemsSignature } from './utils'
import { Cheque, ThirdParty } from './types'
Expand Down Expand Up @@ -129,6 +130,13 @@ export function* thirdPartySaga(builder: BuilderAPI, catalystClient: CatalystCli
],
resetThirdPartyProgressAction
)
yield takeEvery(CLOSE_MODAL, handleCloseModal)

function* handleCloseModal(action: CloseModalAction) {
if (action.payload.name === 'PublishWizardCollectionModal') {
yield put(clearThirdPartyErrors())
}
}

function* handleLoginSuccess(action: LoginSuccessAction) {
const { wallet } = action.payload
Expand Down
Loading