Releases: logaretm/villus
v2.0.2
v2.0.1
v2.0
A new major release of villus
with Vue 2.7 support and API improvements.
Vue 2.7 Support π
Villus now supports Vue 2.7+ releases, so go ahead and try it out in your Vue 2.7 projects!
π Breaking Changes
Dropping higher-order components
Villus is now strictly a composition API library, the higher-order components were dropped in favor of a lighter footprint and compatibility with Vue 2.7 due to differences in VDOM API.
The Higher-order components API was mostly around for compatibility purposes and wasn't documented properly to encourage using the composition API.
Pausing Queries/Subscriptions
The API for stopping auto-refetch behaviors was changed. Instead of having explicit resume
and pause
functions you could pass a boolean, function that returns a boolean or a boolean ref.
Here are a few examples of how that works now:
const { data } = useQuery({
query: GetPostById,
variables,
// Don't re-fetch automatically unless the id is present
paused: ({ id }) => !id,
})
const { data, execute } = useQuery({
query: GetPostById,
variables,
// This query is now "lazy" and you have to trigger executions manually with `execute`.
paused: true,
});
The docs offer more examples and use cases for this API.
Aside from that, it also offers a clear distinction from the recently introduced skipped queries.
v1.2.5
v1.2.4
v1.2.3
π New Features
- Added
maxOperationCount
option to thebatch
plugin to allow fine control over how many queries can be executed in a batch. Docs
π Bug Fixes
- Fixed calling
query.unwatchVariables()
can error out if variables are not watched by default (#164) thanks to @callumacrae
v1.2.2
v1.2.1
v1.2.0
π New Features
- Added
skip
option touseQuery
which prevents executing queries if it is evaluated totrue
.
const route = useRoute();
// skip fetching if route param `id` does not exist
const shouldSkip = computed(() => {
return !route.params.id
});
const { data, isFetching } = useQuery({
// pass as ref ...
skip: shouldSkip,
});
// pass as a function, which rescives the current variables as an argument
const { data, isFetching } = useQuery({
// ...,
skip: (variables) => {
return !variables.id;
},
});
useQuery
variables
option can now be a function that returns a variables object. This is mainly a DX improvement to avoid having to create computed properties to pass touseQuery
.
const route = useRoute();
const { data, isFetching } = useQuery({
variables: () => {
return { id: route.params.id };
},
});
v1.1.0
π TypeScript
π New Features
This change will allow you to use useQuery
and friends in a limited fashion outside the setup function. This should reduce the occurrences where a client instance cannot be found due to the inject/provide
API caveats.