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

@astrapi69/pwa-update-react

v0.2.0

Published

React UI for PWA update detection: update banner, check-for-updates control, version card and deploy-safe lazy routes — messages-, slot- and store-injectable

Readme

@astrapi69/pwa-update-react

React UI for @astrapi69/pwa-update: a discreet update banner, an active "check for updates" control, a version card, and deploy-safe lazy routes.

npm install @astrapi69/pwa-update @astrapi69/pwa-update-react

Quick start

import { createUpdateStore } from "@astrapi69/pwa-update";
import { PwaUpdateProvider, UpdateBanner } from "@astrapi69/pwa-update-react";

const store = createUpdateStore({
    build: { version: __APP_VERSION__, buildHash: __BUILD_HASH__ },
    manifestUrl: `${import.meta.env.BASE_URL}version.json`,
    storageNamespace: "my-app",
});

export function App() {
    return (
        <PwaUpdateProvider store={store}>
            <Routes />
            <UpdateBanner />
        </PwaUpdateProvider>
    );
}

Both surfaces read the SAME store, so a passively detected update shows up on the settings control without a press, and applying at either place clears both.

useAppUpdate (and therefore UpdateBanner) wires the store's proactive polling automatically — configure it on the store via polling, and the hook starts and stops it with the component lifecycle.

Components

| Export | What it is | |---|---| | UpdateBanner | Connected banner — mount once at the app root. Renders nothing until an update is detected. | | UpdatePrompt | The presentational bar behind it. All copy and callbacks are props; use it directly for a custom flow. | | UpdateCheckControl | Active "check for updates" button, result line and last-checked footer. | | VersionCard | Version / build hash (optionally linked to the commit) / build date. Takes an UpdateCheckControl as a child. | | lazyWithReload | React.lazy that survives a stale deploy — one automatic reload on a chunk-load failure, loop-guarded. | | useAppUpdate | The banner's state, if you render your own. | | useUpdateState | Raw store snapshot via useSyncExternalStore. | | useOnlineStatus | Coarse navigator.onLine signal. |

i18n

All strings live in one messages object with English defaults. Override only what you need:

<PwaUpdateProvider store={store} messages={{ apply: "Aktualisieren" }} locale="de" />

If your app already has an i18n system, build the object in one line — MESSAGE_KEYS documents the keys so they can live in your catalogs:

import { messagesFromTranslate } from "@astrapi69/pwa-update-react";

<PwaUpdateProvider store={store} messages={messagesFromTranslate(t)} locale={lang} />

Styling

Components carry token-backed utility classes and a stable semantic class name on every element (pwa-update-prompt, pwa-update-prompt-apply, pwa-update-check, pwa-version-card, …). Two ways to fit your design:

  1. Tailwind + design tokens — define --bg-surface, --fg-primary, --accent, --border etc. and the components inherit your theme.
  2. Plain CSS — target the semantic class names and ignore the utilities.

Buttons additionally go through a slot, so a design-system primitive drops in:

<PwaUpdateProvider store={store} Button={MyButton} />

The slot Button receives variant (default | outline | ghost) and size (default | sm); the default renders a plain <button> carrying them as data-variant / data-size.

The iOS restart hint

On an installed iOS PWA, skipWaiting() + reload often does not activate the new worker — only a full app close-and-reopen does. UpdateBanner shows the fullRestartHint message in exactly that situation, driven by the store's needsFullRestart state rather than a host-side check, so it cannot be forgotten. Background: the "Platform quirks this package encodes" section of the core package README.

License

MIT © Asterios Raptis