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

autosuspense

v1.0.3

Published

Automatic suspense wiring block for React.

Readme

AutoSupense

AutoSuspense is a lightweight React utility that automatically composes Suspense fallback UI based on your component tree without manually wiring nested <Suspense> boundaries.

It lets you define fallback UI at the component level, while a parent <AutoSuspense> boundary handles rendering everything correctly.


Why AutoSuspense?:

React Suspense solves async rendering, but fallback composition quickly becomes messy:

<Suspense fallback={<PageSkeleton />}>
  <Header />
  <Suspense fallback={<FeedSkeleton />}>
    <Feed />
  </Suspense>
</Suspense>

AutoSuspense removes that boilerplate:

<AutoSuspense>
  <Page />
</AutoSuspense>

Each component defines it's own fallback and autosuspense builds the fallback tree for you.

import { Suspend } from "autosuspense";
import Feed from "./Feed";
import Sidebar from "./Sidebar";

function Page() {
  return (
    <div>
      <Feed />
      <Sidebar />
    </div>
  );
}

export default Suspend(Page, <div>Loading page...</div>);

Installation:

npm install autosuspense

Usage

  1. Add AutoSuspense boundary
import { AutoSuspense } from "autosuspense";

function App() {
  return (
    <AutoSuspense>
      <Page />
    </AutoSuspense>
  );
}
  1. Wrap components with Suspend
import { Suspend } from "autosuspense";

const UserCard = () => {
  const data = resource.read(); // may suspend
  return <div>{data.name}</div>;
};

export default Suspend(UserCard, <div>Loading user...</div>);
  • Nested components automatically compose
const Parent = () => <Child />;

export default Suspend(Parent, <div>Outer Loader...</div>);
const Child = () => {
  const data = resource.read();
  return <div>{data}</div>;
};

export default Suspend(Child, <div>Inner Loader...</div>);

👉 Resulting fallback:

Outer Loader...
  Inner Loader...

Using fallback maps (Per Suspense Reusable Fallbacks)

Instead of passing JSX everywhere, define reusable fallbacks once based required design. Use this to compose multiple fallback designs in the same component.

  • Define prefabs at the root
import { AutoSuspense } from "autosuspense";
import PageSkeleton from "./skeletons/PageSkeleton";
import CardSkeleton from "./skeletons/CardSkeleton";

function App() {
  return (
    <AutoSuspense
      fallbacks={{
        page: PageSkeleton,
        card: CardSkeleton,
      }}
    >
      <Page />
    </AutoSuspense>
  );
}

Use fallback map keys in components:

import { Suspend } from "autosuspense";

function Page() {
  return <Feed />;
}

export default Suspend(Page, "page");
function Feed() {
  const data = resource.read();
  return <div>{data}</div>;
}

export default Suspend(Feed, "card");

Resulting fallback UI

PageSkeleton
  CardSkeleton

Core Idea:

  • Wrap a subtree with <AutoSuspense>.
  • Wrap components with Suspend().
  • Each component declares its fallback.
  • AutoSuspense automatically composes the fallback UI tree without explicit maintaince and wiring.
  • Fallback maps automatically help compose UI changes without changing the actual Component.

Fallback Options:

You can provide fallbacks in multiple ways:

  1. JSX element:
Suspend(Component, <Skeleton />);
  1. Component:
Suspend(Component, SkeletonComponent);
  1. String:
Suspend(Component, SkeletonComponent);

AutoSuspense aims to make and enhance fallback creation and make it's maintainence easier.