diff --git a/CHANGELOG.md b/CHANGELOG.md index 199df077f..d60e94c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ Changelog _Note: Gaps between patch versions are faulty, broken or test releases._ +## v4.0.0-beta.118 (2024-08-01) + +#### :bug: Bug Fix + +* Added `join: 'replace'` for router transitions. It allows to avoid collisions during calls of `push` and `replace` `b-router` + ## v4.0.0-beta.117 (2024-07-31) #### :house: Internal diff --git a/package.json b/package.json index d4aff445f..e416e6111 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "packageManager": "yarn@4.0.2", "typings": "index.d.ts", "license": "MIT", - "version": "4.0.0-beta.117", + "version": "4.0.0-beta.118", "author": { "name": "kobezzza", "email": "kobezzza@gmail.com", diff --git a/src/components/base/b-router/CHANGELOG.md b/src/components/base/b-router/CHANGELOG.md index 1223bbf81..fc321b3d0 100644 --- a/src/components/base/b-router/CHANGELOG.md +++ b/src/components/base/b-router/CHANGELOG.md @@ -9,6 +9,12 @@ Changelog > - :house: [Internal] > - :nail_care: [Polish] +## v4.0.0-beta.118 (2024-08-01) + +#### :bug: Bug Fix + +* Added `join: 'replace'` for router transitions. It allows to avoid collisions during calls of `push` and `replace` + ## v4.0.0-beta.112 (2024-07-22) #### :bug: Bug Fix diff --git a/src/components/base/b-router/modules/transition/class.ts b/src/components/base/b-router/modules/transition/class.ts index 16418d48f..6488838fb 100644 --- a/src/components/base/b-router/modules/transition/class.ts +++ b/src/components/base/b-router/modules/transition/class.ts @@ -8,6 +8,8 @@ import symbolGenerator from 'core/symbol'; +import type { AsyncPromiseOptions } from 'core/async'; + import * as router from 'core/router'; import type { Router } from 'core/router/interface'; @@ -20,8 +22,9 @@ import type { TransitionContext } from 'components/base/b-router/modules/transit const $$ = symbolGenerator(); -const transitionLabel = { - label: $$.transition +const transitionOptions: AsyncPromiseOptions = { + label: $$.transition, + join: 'replace' }; export default class Transition { @@ -156,13 +159,13 @@ export default class Transition { this.initNewRouteInfo(); this.scroll.createSnapshot(); - await $a.promise(this.scroll.updateCurrentRouteScroll(), transitionLabel); + await $a.promise(this.scroll.updateCurrentRouteScroll(), transitionOptions); // We didn't find any route matching the given ref if (this.newRouteInfo == null) { // The transition was user-generated, then we need to save the scroll if (!SSR && this.method !== 'event' && this.ref != null) { - await $a.promise(engine[this.method](this.ref, this.scroll.getSnapshot()), transitionLabel); + await $a.promise(engine[this.method](this.ref, this.scroll.getSnapshot()), transitionOptions); } return; @@ -268,7 +271,7 @@ export default class Transition { return; } - await $a.promise(engine[this.method](newRoute.url, plainInfo), transitionLabel).then(() => { + await $a.promise(engine[this.method](newRoute.url, plainInfo), transitionOptions).then(() => { const isSoftTransition = r.route != null && Object.fastCompare( router.convertRouteToPlainObjectWithoutProto(currentRoute), router.convertRouteToPlainObjectWithoutProto(newRoute)