github logaretm/villus v2.0.0
v2.0

latest releases: v3.5.1, v3.5.0, v3.4.0...
2 years ago

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.

Don't miss a new villus release

NewReleases is sending notifications on new releases.