Skip to content

v2.2.0

Compare
Choose a tag to compare
@logaretm logaretm released this 03 Mar 19:20
· 68 commits to main since this release

πŸ†• New features

Thanks to @jbaubree for suggesting implementing event hooks, which is a little nicer than using a watcher for detecting when a query concludes or fails.

onSuccess

This is called whenever a new result is available.

<script setup>
import { useQuery } from 'villus';

const { data } = useQuery({
  query: GetPostById,
  variables,
  onSuccess: (data) => {
    console.log(data)
  },
});
</script>

onError

It is triggered when an error occurs.

<script setup>
import { useQuery } from 'villus';

const { data } = useQuery({
  query: GetPostById,
  variables,
  onError: (err) => {
    console.log(err)
  },
});
</script>