Skip to content

Commit

Permalink
[fix] Actions: Common.historyPush not resolve when window.open
Browse files Browse the repository at this point in the history
  • Loading branch information
MatrixAge committed Oct 30, 2023
1 parent abbed7b commit 62f0106
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/xgen/actions/Common/historyPush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ export default ({ namespace, extra }: Args) => {
: undefined
const params = search || query ? `?${search ?? ''}${query ?? ''}` : ''

if (payload.pathname.startsWith('http')) {
if (payload.pathname.startsWith('http')) {
resolve()

return window.open(payload.pathname + params)
} else {
if (payload.public) {
if (payload.public) {
resolve()

return window.open(window.location.origin + payload.pathname + params)
}

window.addEventListener('popstate', () => resolve(), { once: true })

if (history.location.pathname.indexOf(payload.pathname) !== -1) {
if (history.location.pathname.indexOf(payload.pathname) !== -1) {
resolve()

window.$app.Event.emit(`${namespace}/refetch`)
} else {
history.push({
Expand Down

0 comments on commit 62f0106

Please sign in to comment.