Skip to content

Commit 0e24ea3

Browse files
committed
release: v4.0.0-beta.10
1 parent 837dc20 commit 0e24ea3

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

CHANGELOG.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
# [4.0.0-beta.10](https://github.com/vuejs/vue-router-next/compare/v4.0.0-beta.9...v4.0.0-beta.10) (2020-09-18)
2+
3+
### Bug Fixes
4+
5+
- **history:** gracefully handle empty state ([cbcf2a9](https://github.com/vuejs/vue-router-next/commit/cbcf2a95a2af001c8aea96f3c76c4c4ef139219f)), closes [#366](https://github.com/vuejs/vue-router-next/issues/366)
6+
- **types:** better type for navigate ([0384cb0](https://github.com/vuejs/vue-router-next/commit/0384cb062d50f6be37512410b4c2d170896dc9cb))
7+
- **types:** explicit types on navigate ([36d218c](https://github.com/vuejs/vue-router-next/commit/36d218c15268d0d3d15d4ed3adc75c8cb09ed68b))
8+
- **types:** fix types for redirect records ([a77f148](https://github.com/vuejs/vue-router-next/commit/a77f1485323ef3b654077ecb227fd5a0373d3a2f))
9+
- **warn:** correctly warn against unused next ([47cd7b9](https://github.com/vuejs/vue-router-next/commit/47cd7b97bb7a3999178a26a4ca1af955178ea5d6))
10+
11+
### Code Refactoring
12+
13+
- **types:** Rename ScrollBehavior to RouterScrollBehavior ([9fc0996](https://github.com/vuejs/vue-router-next/commit/9fc09969db854bc0201454fbecd546637b76213a))
14+
15+
### Features
16+
17+
- **router:** remove partial Promise from router.go ([6ed6eee](https://github.com/vuejs/vue-router-next/commit/6ed6eee38b59eb0b6dec0bcb7d73e24203e20ba4))
18+
- **types:** allow extending meta fields ([#407](https://github.com/vuejs/vue-router-next/issues/407)) ([706e84f](https://github.com/vuejs/vue-router-next/commit/706e84f0099a2a04485dfa98449fdc875442bb49))
19+
- **warn:** point to scrollBehavior in message ([70ce7fe](https://github.com/vuejs/vue-router-next/commit/70ce7feefac3fddd2a9641fcc2ccc66b4b108775))
20+
21+
### BREAKING CHANGES
22+
23+
- **router:** The `router.go()` methods doesn't return anything
24+
(like in Vue Router 3) anymore. The existing implementation was wrong as it
25+
would resolve the promise for the following navigation if `router.go()`
26+
was called with something that wasn't possible e.g. `router.go(-20)`
27+
right after entering the application would not do anything. Even worse,
28+
the promise returned by that call would resolve **after the next
29+
navigation**. There is no proper native API to implement this
30+
promise-based api properly, but one can write a version that should work
31+
in most scenarios by setting up multiple hooks right before calling
32+
`router.go()`:
33+
34+
```js
35+
export function go(delta) {
36+
return new Promise((resolve, reject) => {
37+
function popStateListener() {
38+
clearTimeout(timeout)
39+
}
40+
window.addEventListener('popstate', popStateListener)
41+
42+
function clearHooks() {
43+
removeAfterEach()
44+
removeOnError()
45+
window.removeEventListener('popstate', popStateListener)
46+
}
47+
48+
// if the popstate event is not called, consider this a failure
49+
const timeout = setTimeout(() => {
50+
clearHooks()
51+
reject(new Error('Failed to use router.go()'))
52+
// It's unclear of what value would always work here
53+
}, 10)
54+
55+
setImmediate
56+
57+
const removeAfterEach = router.afterEach((_to, _from, failure) => {
58+
clearHooks()
59+
resolve(failure)
60+
})
61+
const removeOnError = router.onError(err => {
62+
clearHooks()
63+
reject(err)
64+
})
65+
66+
router.go(delta)
67+
})
68+
}
69+
```
70+
71+
- **types:** there is already an existing type named `ScrollBehavior`,
72+
so we are renaming our type to avoid any confusions and allow the user
73+
to use both types at the same type (which given what the existing
74+
`ScrollBehavior` type is designed for, will likely happen).
75+
176
# [4.0.0-beta.9](https://github.com/vuejs/vue-router-next/compare/v4.0.0-beta.8...v4.0.0-beta.9) (2020-09-01)
277

378
Build related fixes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-router",
3-
"version": "4.0.0-beta.9",
3+
"version": "4.0.0-beta.10",
44
"main": "dist/vue-router.cjs.js",
55
"browser": "dist/vue-router.esm-browser.js",
66
"unpkg": "dist/vue-router.global.js",

0 commit comments

Comments
 (0)