Stale Data Notice

Stale Data Notice is a copy-paste React component that stops acting on out-of-date numbers before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/stale-data-notice
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsActing on out-of-date numbers

Was this component page useful?

How do I install Stale Data Notice?

pnpm dlx shadcn@latest add @bollard/stale-data-notice

The files land in your project. They're yours to edit.

How do I use Stale Data Notice in React?

stale-data-notice-usage.tsx
import { StaleDataNotice } from "@/components/ui/stale-data-notice"

<StaleDataNotice
  updatedAt={updatedAt}
  maxAge={10 * 60_000}
  consequence="Prices may have changed."
  onRefresh={() =>
    new Promise<void>((resolve) =>
      setTimeout(() => {
        setUpdatedAt(Date.now())
        resolve()
      }, 800),
    )
  }
/>

What input mistakes does Stale Data Notice catch?

  • Data older than maxAge
  • Returning to the tab after being away longer than awayAfter
  • Refresh failures, with an error

What props does Stale Data Notice accept?

StaleDataNotice props
PropTypeDefault
maxAge

Data older than this (ms) counts as stale.

number—
awayAfter

Coming back to the tab after being away longer than this (ms) counts as stale.

number—
updatedAt* (required)

When the data on screen was fetched.

Date | number | string—
onRefresh* (required)

Fetch fresh data. Return a promise to show progress; the notice hides once `updatedAt` moves.

() => void | Promise<void>—
message

Headline; `{age}` becomes "18 minutes".

string"This page is {age} old."
consequence

What could be wrong now, e.g. "Prices may have changed."

string"Some details may have changed."
refreshLabel

Label of the refresh button.

string"Refresh"
refreshingLabel

Label while refreshing.

string"Refreshing…"
dismissLabel

Accessible label of the dismiss button.

string"Dismiss and keep the current data"
errorText

Shown when `onRefresh` rejects.

string"Couldn't refresh. Try again."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Stale Data Notice accessible?

  • Notice is role=status; errors use role=alert
  • Refresh button disables while refreshing; dismiss has an aria-label
  • Icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Age comes from the updatedAt you pass
  • Does not refresh by itself; onRefresh does

What expensive mistakes does Stale Data Notice stop?

Acting on out-of-date numbers

Also known as

stale data · refresh · last updated · dashboard · cache · max age · visibilitychange · swr

Field type

What dependencies does Stale Data Notice require?

Stale Data Notice facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameStale Data Notice
Registry identifier@bollard/stale-data-notice
Install commandnpx shadcn@latest add @bollard/stale-data-notice
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Stale Data Notice

What form validation mistake does Stale Data Notice catch?

Stale Data Notice prevents acting on out-of-date numbers. Tells people when the numbers on screen may be out of date, after time away or past a max age, with a one-tap refresh. Catches: Data older than maxAge, Returning to the tab after being away longer than awayAfter, Refresh failures, with an error. Limitation: validate stale-data-notice schemas on backend.

How do I install stale-data-notice with shadcn?

Run `npx shadcn@latest add @bollard/stale-data-notice`. Sources added: registry/default/stale-data-notice/stale-data-notice.tsx. Package requirements: lucide-react.

What props customize Stale Data Notice?

Stale Data Notice accepts `maxAge`, `awayAfter`, `updatedAt`, `onRefresh`, `message`. Configures stale data, refresh, last updated behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of stale-data-notice?

Age comes from the updatedAt you pass. Does not refresh by itself; onRefresh does Server requirement: backend verification for stale-data-notice.

How does Stale Data Notice meet accessibility guidelines?

Notice is role=status; errors use role=alert. Refresh button disables while refreshing; dismiss has an aria-label. Icons are aria-hidden. Minimizes errors: dashboard showing old data, stale tab data.

Which components pair with Stale Data Notice?