npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nuxt-async-data-addons

v0.0.1

Published

Collection of common async data addons for Nuxt

Readme

nuxt-async-data-addons

npm version npm downloads license Nuxt

A collection of common async data addons for Nuxt, for use with createUseAsyncData and createUseFetch.

Nuxt 4.6 added defineUseAsyncDataAddon and defineUseFetchAddon, which package reusable behavior for your data fetching composables. This module saves you from writing the common ones yourself.

Setup

npx nuxt module add nuxt-async-data-addons

Addons are auto-imported. Add the ones you need to createUseAsyncData or createUseFetch, optionally with default options for your project, then override those options at the call site when needed:

export const useAppAsyncData = createUseAsyncData({
  addons: [minDurationUseAsyncDataAddon({ minDuration: 400 })],
})
export const useAppFetch = createUseFetch({
  addons: [minDurationUseFetchAddon({ minDuration: 400 })],
})
<script setup lang="ts">
const { data: mountains } = await useAppAsyncData(
  'mountains',
  () => $fetch('/api/mountains'),
)

const { data: rivers } = await useAppFetch('/api/rivers', {
  minDuration: 0,
})
</script>

Addons

Minimum duration

| Addon | Use with | | --- | --- | | minDurationUseAsyncDataAddon | createUseAsyncData | | minDurationUseFetchAddon | createUseFetch |

Keeps a request pending for at least minDuration milliseconds, so that loading states don't flash when it finishes quickly.

| Option | Type | Description | | --- | --- | --- | | minDuration | number | Minimum duration of the request in milliseconds. The addon does nothing when it is unset or 0. |

  • It only applies on the client, so it never slows down server-side rendering. Data already in the payload is not re-fetched during hydration, so there is no wait there either.
  • A request that fails early is also held for the minimum duration, so errors don't flash either.
  • Aborting the request, or starting a new one for the same key, drops the remaining wait.

Contributing

# install dependencies
pnpm install

# generate type stubs and prepare the playgrounds
pnpm dev:prepare

# start the playground on Nuxt 4
pnpm dev

# start the playground on the latest Nuxt 5 nightly
pnpm dev:v5

# lint and type check
pnpm lint
pnpm test:types

# run the tests (the e2e tests need a browser: pnpm playwright-core install chromium)
pnpm test

Each addon has its own file in src/runtime/addons, where every export is auto-imported, its own page in playground/app/pages, and its own checks in test/e2e/addons, registered in describeAddons.ts. Each addon is a function that takes default options. Where it applies to both composables, a file exports one per composable, such as minDurationUseAsyncDataAddon and minDurationUseFetchAddon. playground-v5 extends playground as a layer, so the same pages run on both Nuxt versions.

Commits follow Conventional Commits, which uppt uses to prepare releases. Commits and pull requests about a specific addon use its name as the scope, such as fix(minDuration): ....

License

MIT