|
| 1 | +# [0.8.0](https://github.com/posva/unplugin-vue-router/compare/v0.7.0...v0.8.0) (2024-02-22) |
| 2 | + |
| 3 | +Based on the feedback of the RFC, the Data Loaders have been redesigned from the ground up and are now way more flexible and powerful. As a result, if you were using the experimental data loaders, make sure to check the list of breaking changes and the new RFC at https://uvr.esm.is/rfcs/data-loaders. We are looking for early testers and feedback! |
| 4 | + |
| 5 | +### Bug Fixes |
| 6 | + |
| 7 | +- allow errors outside of navigation ([ae37a8e](https://github.com/posva/unplugin-vue-router/commit/ae37a8ec218ba62f0bac20039d6e8942f63f0d96)) |
| 8 | +- avoid uncatchable rejection ([fa0c794](https://github.com/posva/unplugin-vue-router/commit/fa0c794a066ace43cf87e252191943f4c856170d)) |
| 9 | +- delay setting the error ([3d341ae](https://github.com/posva/unplugin-vue-router/commit/3d341ae5a63f6930e7a54a80af007132f3532f5a)) |
| 10 | +- discard loads from canceled navigations ([aac66c1](https://github.com/posva/unplugin-vue-router/commit/aac66c16826f5a5f68da478663706385ac31d45d)), closes [posva/unplugin-vue-router#200](https://github.com/posva/unplugin-vue-router/issues/200) |
| 11 | +- router.push types ([98cb17b](https://github.com/posva/unplugin-vue-router/commit/98cb17bf9d837f5cbaa370cfa9c8d7f377818080)) |
| 12 | +- run nested loaders once when used across places ([73a6cc5](https://github.com/posva/unplugin-vue-router/commit/73a6cc5c875b95c6921c1b1dba1207aa80c2a878)) |
| 13 | +- **types:** correct types in navigation guards ([3f01155](https://github.com/posva/unplugin-vue-router/commit/3f01155e8cb609d1af07b115103907176d44aab8)) |
| 14 | +- **types:** correctly extend client ([d226cf9](https://github.com/posva/unplugin-vue-router/commit/d226cf9266a36564bccc8ee9a0b1c5980d5c6000)) |
| 15 | +- **types:** remove null from non raw star param ([0b71ad5](https://github.com/posva/unplugin-vue-router/commit/0b71ad5fd9e0f79b8a3508cc8849ef4c85e0f029)) |
| 16 | +- **types:** restrict what can be imported from the package ([8748644](https://github.com/posva/unplugin-vue-router/commit/874864497414ad503b9a5c185f650c5d0c7a5746)), closes [#289](https://github.com/posva/unplugin-vue-router/issues/289) |
| 17 | +- **types:** use `vue-router/auto-routes` ([2dc0446](https://github.com/posva/unplugin-vue-router/commit/2dc0446ee956c01cdc97a912f3362d62f35906cd)) |
| 18 | +- use single alias for reused components on different paths ([1544363](https://github.com/posva/unplugin-vue-router/commit/1544363383992a38339786178a836ad7e1bad712)) |
| 19 | + |
| 20 | +### Code Refactoring |
| 21 | + |
| 22 | +- rename `pending` to `isLoading` ([9502751](https://github.com/posva/unplugin-vue-router/commit/950275193e43936481337f291ce79b4f60a27d76)) |
| 23 | +- refactor!: remove deprecated APIs ([0415b9e](https://github.com/posva/unplugin-vue-router/commit/0415b9eb86a68f9fe687a0bae02405bd2123f2a9)) |
| 24 | +- refactor(data-loaders)!: rewrite of data loaders ([f0b7b58](https://github.com/posva/unplugin-vue-router/commit/f0b7b58e0a588146f70b38d9037e4221204b25c7)) |
| 25 | +- refactor!: remove `setupLoaderGuard` ([8094f62](https://github.com/posva/unplugin-vue-router/commit/8094f62f5871988611d82e857867064b2d959189)) |
| 26 | + |
| 27 | +### Features |
| 28 | + |
| 29 | +- add pinia colada properties ([63a768f](https://github.com/posva/unplugin-vue-router/commit/63a768f8e8e7fce2a60fc8f76ce54bba303ce041)) |
| 30 | +- commit option ([56b2a4d](https://github.com/posva/unplugin-vue-router/commit/56b2a4d6e35aa8ef5d45f4ee914ab86a7577f8e5)), closes [posva/unplugin-vue-router#201](https://github.com/posva/unplugin-vue-router/issues/201) |
| 31 | +- **data-fetching:** add server option ([d4d2f46](https://github.com/posva/unplugin-vue-router/commit/d4d2f46c156d8837ec5f403ff21ffe9a86065853)) |
| 32 | +- **data-loaders:** abort the signal for old pending locations ([afabb47](https://github.com/posva/unplugin-vue-router/commit/afabb47c4ed2428b11388d14f676a1b95eb9dec1)) |
| 33 | +- **data-loaders:** add abort signal to navigation ([a175fa7](https://github.com/posva/unplugin-vue-router/commit/a175fa7b9800f7abce454fa2a46c9e4163293494)) |
| 34 | +- **data-loaders:** allow changing the navigation result ([7a7da74](https://github.com/posva/unplugin-vue-router/commit/7a7da74a3bddf3e0f836f70a2e0df4b89bb52a82)) |
| 35 | +- **data-loaders:** pass the signal to the loader ([85d0494](https://github.com/posva/unplugin-vue-router/commit/85d049435e6edb8341b2430653a807fbf2906ef0)) |
| 36 | +- handle thrown errors ([2e38544](https://github.com/posva/unplugin-vue-router/commit/2e385445546ee363167860c03c445ca081614eb3)) |
| 37 | +- inject in nested loaders ([b0aa0b3](https://github.com/posva/unplugin-vue-router/commit/b0aa0b391da76ecc6493632ae1952ff773cebba8)) |
| 38 | +- **loaders:** thrown navigation results take precedence ([2aaaf56](https://github.com/posva/unplugin-vue-router/commit/2aaaf567f99059c5b679e3d25b34bf6d2145f9d2)) |
| 39 | +- return a promise of data only ([d2dda40](https://github.com/posva/unplugin-vue-router/commit/d2dda40cb68cb87dca701ed682dc1d9cf9349b05)) |
| 40 | +- run loaders with access to global inject and provide ([9d95e27](https://github.com/posva/unplugin-vue-router/commit/9d95e27aef4e68f2d53a36cc18007ad407447a07)) |
| 41 | +- track used params ([b2ae763](https://github.com/posva/unplugin-vue-router/commit/b2ae7633b34fd35dce00d0a7a25c9f1cf744bad3)) |
| 42 | + |
| 43 | +### Performance Improvements |
| 44 | + |
| 45 | +- compute params once ([322f220](https://github.com/posva/unplugin-vue-router/commit/322f2203da10bd1b18288060d3cda91c95dfd28d)) |
| 46 | +- use a shallowRef for data ([aae0c70](https://github.com/posva/unplugin-vue-router/commit/aae0c70a8051e9aa8f21c643d1b0a2d916b354a5)) |
| 47 | +- use for of instead of forEach ([1635745](https://github.com/posva/unplugin-vue-router/commit/1635745cc58f5e312602ee2b4430b811cd63808b)) |
| 48 | + |
| 49 | +### BREAKING CHANGES |
| 50 | + |
| 51 | +- Remove the deprecated APIs: |
| 52 | + |
| 53 | +- `createPrefixTree()` -> `new PrefixTree()` |
| 54 | +- `VueRouterExports` -> `VueRouterAutoImports` |
| 55 | + |
| 56 | +- Data Loaders have been redesigned to be more flexible |
| 57 | + and account for other libraries. Notably, the caching behavior has been |
| 58 | + moved out of the basic loader to an extended one [pinia-colada](https://uvr.esm.is/rfcs/data-loaders/colada.html) and the [basic loader](https://uvr.esm.is/rfcs/data-loaders/basic.html) |
| 59 | + has no cache. All of the pending bugs have also been fixed. |
| 60 | + I recommend you to give the RFC examples a new read to get |
| 61 | + setup: https://uvr.esm.is/rfcs/data-loaders/. Most of the changes are |
| 62 | + simplifying things by removing them. |
| 63 | + Here is a list of the breaking changes to simplify |
| 64 | + migration: |
| 65 | + |
| 66 | + - The `dataFetching` option is no longer needed. |
| 67 | + - Manual work needed to add loaders with `HasDataLoaderMeta` has been |
| 68 | + removed. It is just no longer needed. Loaders are picked up from lazy |
| 69 | + loaded components and must otherwise be directly added to a `meta.loaders` |
| 70 | + array. See the example at https://uvr.esm.is/rfcs/data-loaders/#basic-example |
| 71 | + - The function `setupDataFetchingGuard` has been replaced with a Vue |
| 72 | + Plugin. See https://uvr.esm.is/rfcs/data-loaders/#data-loader-setup |
| 73 | + for details. |
| 74 | + - If you were relying on `cacheTime`, use the `staleTime` option in the |
| 75 | + new [`defineColadaLoader()`](https://uvr.esm.is/rfcs/data-loaders/colada) based off [@pinia/colada](https://github.com/posva/pinia-colada) |
| 76 | + - To reduce the dependency on file-based router, things have been |
| 77 | + refactored and none of the defineLoader functions are automatically |
| 78 | + imported anymore. You can add them yourself to the list of auto |
| 79 | + imports, or import them from `vue-router/auto`. The good news is you |
| 80 | + no longer need to use the plugin in order to benefit from the data |
| 81 | + loaders; they can be directly imported from |
| 82 | + `unplugin-vue-router/runtime` **even if you don't want file-based routing**. |
| 83 | + |
| 84 | + If you find missing information or improvements, please open a Pull |
| 85 | + Request to improve the `CHANGELOG.md`. |
| 86 | + |
| 87 | + - The navigation guard is replaced in favor of a Vue |
| 88 | + plugin: |
| 89 | + |
| 90 | + Replace |
| 91 | + |
| 92 | + ```ts |
| 93 | + import { setupLoaderGuard } from 'vue-router/auto' |
| 94 | + |
| 95 | + setupLoaderGuard({ router, app }) |
| 96 | + ``` |
| 97 | + |
| 98 | + with |
| 99 | + |
| 100 | + ```ts |
| 101 | + import { DataLoaderPlugin } from 'vue-router/auto' |
| 102 | + |
| 103 | + app.use(DataLoaderPlugin, { router }) |
| 104 | + ``` |
| 105 | + |
| 106 | + - `vue-router/auto/routes` becomes `vue-router/auto-routes`. This change was necessary to improve compatibility with |
| 107 | + TypeScript and other tools in the ecosystem. Most of the time you don't |
| 108 | + need to use this path but if you were using it, replace it: |
| 109 | + |
| 110 | + ```diff |
| 111 | + - import { } from 'vue-router/auto/routes' |
| 112 | + + import { } from 'vue-router/auto-routes' |
| 113 | + ``` |
| 114 | + |
| 115 | + - Data Loaders now return an `isLoading` property instead |
| 116 | + of `pending`. This aligns better with the wording of Data Loaders being |
| 117 | + in a loading state rather than pending, which can have more meanings. |
| 118 | + - You know need to add `unplugin-vue-router/client` to the `types` property of your tsconfig. See [setup](https://uvr.esm.is/introduction.html#setup) for an example. |
| 119 | + |
| 120 | + - the existing `defineLoader` is being replaced by a |
| 121 | + basic loader without cache. The version with cache will be implemented |
| 122 | + by adding a library that properly handles the caching. This new strategy |
| 123 | + will also enable other integrations like VueFire, Apollo, and custom |
| 124 | + ones. Keep an eye (subscribe) to the RFC for news and to discus about |
| 125 | + the future of Data Loaders: https://github.com/vuejs/rfcs/discussions/460 |
| 126 | + - since data loaders aren't meant to be awaited in script |
| 127 | + setup (they are awaited at the navigation level), they now return a |
| 128 | + promise of the raw data only, not of the UseDataLoaderReturn, to make it |
| 129 | + clearer that this syntax is a bit special and should only be used within |
| 130 | + nested loaders. This change also brings other benefits like allowing |
| 131 | + lazy loaders to be awaited within loaders without changing their usage |
| 132 | + outside, in components. Also, allowing different types of commit while |
| 133 | + still allowing data to be awaited within loaders. |
| 134 | + |
1 | 135 | # [0.7.0](https://github.com/posva/unplugin-vue-router/compare/v0.6.4...v0.7.0) (2023-09-22)
|
2 | 136 |
|
3 | 137 | ### Bug Fixes
|
|
0 commit comments