-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor defineLoader #246
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posva
force-pushed
the
refactor/create-define-loader
branch
from
November 28, 2023 10:54
9f2252b
to
d681268
Compare
Close #201
BREAKING CHANGE: since data loaders aren't meant to be awaited in script setup (they are awaited at the navigation level), they now return a promise of the raw data only, not of the UseDataLoaderReturn, to make it clearer that this syntax is a bit special and should only be used within nested loaders. This change also brings other benefits like allowing lazy loaders to be awaited within loaders without changing their usage outside, in components. Also, allowing different types of commit while still allowing data to be awaited within loaders.
BREAKING CHANGE: While this was a private API, we are documenting it here just in case. Replace `_defineBasicLoader` with `defineBasicLoader`
BREAKING CHANGE: The navigation guard is replaced in favor of a Vue plugin: Replace ```ts import { setupLoaderGuard } from 'vue-router/auto' setupLoaderGuard({ router, app }) ``` with ```ts import { DataLoaderPlugin } from 'vue-router/auto' app.use(DataLoaderPlugin, { router }) ```
@SocketSecurity ignore npm/vue-demi@0.14.7 |
BREAKING CHANGE: Data Loaders have been redesigned to be more flexible and account for other libraries. Notably, the caching behavior has been moved out of the basic loader to an extended one and the basic loader has no cache. All of the pending bugs have also been fixed. I recommend you to give the RFC examples a new read to get setup: https://uvr.esm.is/rfcs/data-loaders/. Most of the changes are simplifying things by removing them. Here is a list of the breaking changes to simplify migration: - The `dataFetching` option is no longer needed. - Manual work needed to add loaders with `HasDataLoaderMeta` has been removed. It is just no longer needed. Loaders are picked up from lazy loaded components and must otherwise be directly added to a `meta.loaders` array. See the example at https://uvr.esm.is/rfcs/data-loaders/#basic-example - The function `setupDataFetchingGuard` has been replaced with a Vue Plugin. See https://uvr.esm.is/rfcs/data-loaders/#data-loader-setup for details. - If you were relying on `cacheTime`, use the `staleTime` option in the new [`defineColadaLoader()`](https://uvr.esm.is/rfcs/data-loaders/colada) based off [@pinia/colada](https://github.com/posva/pinia-colada) - To reduce the dependency on file-based router, things have been refactored and none of the defineLoader functions are automatically imported anymore. You can add them yourself to the list of auto imports, or import them from `vue-router/auto`. The good news is you no longer need to use the plugin in order to benefit from the data loaders; they can be directly imported from `unplugin-vue-router/runtime`. If you find missing information or improvements, please open a Pull Request to improve the `CHANGELOG.md`.
BREAKING CHANGE: Remove the deprecated APIs: - `createPrefixTree()` -> `new PrefixTree()` - `VueRouterExports` -> `VueRouterAutoImports`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces multiple breaking changes for a better interoperability with existing libraries
defineLoader()
isn't present in code #202redeclaration of import
error #284 (from fix: use single alias for reused components on different paths #280)