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.