#Same useLazyAsyncData and useFetch - but useLazyAsyncData not fetch on initial render or hard refres

2 messages · Page 1 of 1 (latest)

kindred rapids
#
const {
  status,
  data: airlines,
  error,
  refresh
} = useFetch('/api/airlines/list', {
  lazy: true,
  params: queryItems,
  transform: (airlines: ListResult<Airline>) => transformer(airlines)
})

const {
  status,
  data: airlines,
  error,
  refresh
} = await useLazyAsyncData(
  'airlines',
  () =>
    $fetch('/api/airlines/list', {
      params: queryItems
    }),
  {
    transform: (airlines: ListResult<Airline>) => transformer(airlines)
  }
)```

I have those two functions and I think they are the same? But for some reason the useLazyAsyncData doesn't seem to make the api call on initial load  - it will if I navigate away and navigate back. Any thoughts on what I am doing wrong?
nova comet
#

in the development or in the production ?