From 45672a70f9f8fd932896468f9bfdc6c511013682 Mon Sep 17 00:00:00 2001 From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:27:33 +0900 Subject: fix(frontend): router遷移時にmatchAllに入った場合一度`location.href`を経由するように (#13509) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): router遷移時にmatchAllに入った場合一度`location.href`を経由するように * Update Changelog * Update CHANGELOG.md * remove unnecessary args --- packages/frontend/src/nirax.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'packages/frontend/src/nirax.ts') diff --git a/packages/frontend/src/nirax.ts b/packages/frontend/src/nirax.ts index 616fb104e6..6a8ea09ed6 100644 --- a/packages/frontend/src/nirax.ts +++ b/packages/frontend/src/nirax.ts @@ -373,7 +373,7 @@ export class Router extends EventEmitter implements IRouter { this.currentRoute.value = res.route; this.currentKey = res.route.globalCacheKey ?? key ?? path; - if (emitChange) { + if (emitChange && res.route.path !== '/:(*)') { this.emit('change', { beforePath, path, @@ -408,13 +408,17 @@ export class Router extends EventEmitter implements IRouter { if (cancel) return; } const res = this.navigate(path, null); - this.emit('push', { - beforePath, - path: res._parsedRoute.fullPath, - route: res.route, - props: res.props, - key: this.currentKey, - }); + if (res.route.path === '/:(*)') { + location.href = path; + } else { + this.emit('push', { + beforePath, + path: res._parsedRoute.fullPath, + route: res.route, + props: res.props, + key: this.currentKey, + }); + } } public replace(path: string, key?: string | null) { -- cgit v1.2.3-freya