Skip to content

Releases: logaretm/villus

v2.0.2

28 Dec 15:56
Compare
Choose a tag to compare

πŸ‘• TypeScript

  • Fixed a couple of typing issues with useMutation and its execute() where the data and error values returned were not nullable #182 (#183)

v2.0.1

23 Oct 05:37
Compare
Choose a tag to compare

βš™οΈ Misc

  • Exposed several network utilities to make creating fetch plugins easier, the exposed functions are mergeFetchOptions, makeFetchOptions and parseResponse #163 (47348e1)

v2.0

07 Aug 15:17
Compare
Choose a tag to compare

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

31 Jul 23:34
Compare
Choose a tag to compare

πŸ› Bug Fixes

  • Fixed an issue with batch plugin dropping some fetch options set by previous plugins #166 (#167) thanks to @DaLukasTI

v1.2.4

11 Jul 01:34
Compare
Choose a tag to compare

πŸ‘• TypeScript

  • Exposed GraphQLResponse and ParsedResponse types.

v1.2.3

03 Jul 20:20
Compare
Choose a tag to compare

πŸ†• New Features

  • Added maxOperationCount option to the batch 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

03 Jul 20:12
Compare
Choose a tag to compare

πŸ› Bug Fixes

  • Fixed not being able to resolve global fetch when in worker context #160 (#161) thanks to @bravik

v1.2.1

06 Jun 07:27
Compare
Choose a tag to compare

πŸ› Bug Fixes

  • Fixed isFetching not being set to false if the query was skipped via skip option.

v1.2.0

30 May 07:55
Compare
Choose a tag to compare

πŸ†• New Features

  • Added skip option to useQuery which prevents executing queries if it is evaluated to true.
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 to useQuery.
const route = useRoute();

const { data, isFetching } = useQuery({
  variables: () => {
    return { id: route.params.id };
  },
});

v1.1.0

23 Apr 19:35
Compare
Choose a tag to compare

πŸ‘• TypeScript

πŸ†• New Features

  • feat: enable useQuery etc function outside of setup and outside component by @GavinXue in #156

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.