smolter
API

recoverDeployment

Check for a newer deployment after an initial import fails.

Compatibility

ReactAvailable in this renderer's browser integration.
React SSRClient-side setup for an SSR application; do not execute on the server.
PreactAvailable in this renderer's browser integration.
Preact SSRClient-side setup for an SSR application; do not execute on the server.

Import from @kasperrt/smolter/react/client @kasperrt/smolter/preact/client

Signature

function recoverDeployment(
  options: DeploymentOptions | null,
  destination?: URL,
): Promise<boolean>;

Parameters

Accepts DeploymentOptions or null and an optional destination URL, defaulting to the current location. mountApplication calls this automatically when deployment metadata is supplied.

import { recoverDeployment } from "@kasperrt/smolter/preact/client";

Result

Returns a promise of a boolean: true when recovery was requested, false when no reload was permitted. A custom reload callback receives the destination URL.

Usage

For custom bootstraps, call recovery from the initial import failure handler and retain the original failure when no reload occurs. For application mounting, pass metadata before the initial import.

await mountApplication(routes, root, { deployment });

Safeguards

Null metadata and server rendering are no-ops. Offline, invalid, unchanged or timed-out manifests never reload. A session marker prevents loops; blocked storage disables reload. The original entry script must still be available. Mutations are not replayed.

View implementation ↗