rainxh11/vue-useurl

There is `Unhandled error during execution of setup function` if one of some fields in `options` argument was not provided

guenbakku opened this issue · 0 comments

Version:

  • "@vueuse/core": "9.1.0",
  • "@vueuse/nuxt": "9.1.0",
  • "vue-useurl": "1.0.32"
  • "nuxt": "3.0.0-rc.6"

What happened:

When calling the useUrl() without providing one of following fields in options argument like below, there is the error Unhandled error during execution of setup function like attached image.

List of field cause problem:

  1. path
  2. pathVariables
  3. queryParams
  4. hash
const {url} = useUrl({
  path: '/api/v1/users/:id/search',
  // Bellow comment raise the error
  // pathVariables: {
  //   id: 451,
  // },
  queryParams: {
    search: 'ahmed',
    limit: 50,
    page: 12,
    sort: 'CreatedOn',
    types: ['Cancelled', 'OnGoing'],
  },
  hash: 'hashtag',
  disableCSV: false,
});

image

Expected:

Above fields are optional so it should not raise the error when we did not provide any of these fields in options argument.