Update Banner
A reload prompt that appears when a new service worker is waiting to take over.
A new version is available
Reload to get the latest version of the app.
Installation
Run the following command to install the `update-banner` components:
npx shadcn-svelte@latest add https://more-shadcn.noair.fun/r/update-banner.json
How the detection works
The banner looks up the current registration and watches for a worker that reaches the
installed state while a controller is already active — that combination means a new build is sitting in registration.waiting. A first ever install has no controller, so it never
triggers the prompt.Pressing reload posts
{ type: 'SKIP_WAITING' } to the waiting worker
and reloads once controllerchange fires, falling back to a plain reload after reloadTimeout so a worker that ignores the message cannot strand the app.Your service worker needs to handle the message:
Polling
Browsers only check for a new worker on navigation. Set
pollInterval to look for
one while the app stays open, or call check() yourself after a route change.Driving it yourself
Use
source="manual" with a bindable available to plug in another
signal — SvelteKit's updated store, a version endpoint, or a push message.Countdown
autoReloadAfter reloads on its own after a grace period, with the remaining seconds
shown in the copy. Dismissing cancels it.Position
By default the prompt is a fixed toast in the bottom right. Use
inline to place it
in the flow, or one of the other corners.Every fixed variant anchors to the nearest ancestor with a
transform, filter or backdrop-filter rather than the viewport — that is how CSS works, and it is why
the preview below sits inside this column. Mount it in your root layout to pin it to the window.