Skip to content

Commit

Permalink
fix: 修复preeffect异步带来的影响
Browse files Browse the repository at this point in the history
  • Loading branch information
tingfuyeh committed Dec 3, 2024
1 parent 688e01f commit a1d07f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 9 additions & 7 deletions web/src/polaris/common/ducks/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,15 @@ get preSagas(){
* 判断是否初始化了主账户
*/
*checkAdminUserExist() {
const ret = yield* resolvePromise(checkExistAdminUser())
if (ret?.user) {
console.log('主账户已初始化')
} else {
console.log('主账户没有初始化')
router.navigate('/init')
}
checkExistAdminUser()
.then(res => {
if (!res.user) {
router.navigate('/init')
}
})
.catch(err => {
console.log(err)
})
return true
}

Expand Down
6 changes: 5 additions & 1 deletion web/src/polaris/service/detail/PageDuck.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DetailPageDuck from '@src/polaris/common/ducks/DetailPage'
import { reduceFromPayload, createToPayload } from 'saga-duck'
import { select, put, takeLatest } from 'redux-saga/effects'
import { select, put, takeLatest, take } from 'redux-saga/effects'
import { TAB, ComposedId } from './types'
import InfoDuck from './info/PageDuck'
import InstanceDuck from './instance/PageDuck'
Expand Down Expand Up @@ -115,6 +115,10 @@ export default class RegistryDetailDuck extends DetailPageDuck {
return
}
const subDuck = ducks[tab]
const ready = yield select(subDuck.selectors.ready)
if (!ready) {
yield take(subDuck.types.READY)
}
yield put(subDuck.creators.load({ ...composedId, ...data }))
})
}
Expand Down

0 comments on commit a1d07f0

Please sign in to comment.