smolter
Types

MountApplicationOptions

Configure hash history and deployment recovery before hydration.

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

interface MountApplicationOptions {
  hash?: boolean;
  deployment?: DeploymentOptions | null;
  /** Total initial deferred-data budget in integer milliseconds; not an inactivity timeout. Defaults to 8,000. */
  deferredTimeout?: number;
}

Fields

hash defaults to false. deployment accepts DeploymentOptions or null. Pass generated deployment metadata during mounting to recover a missing initial route chunk. The previous boolean hash argument remains supported.

await mountApplication(routes, root, { hash: false, deployment });

Deferred timeout compatibility in 0.4.5

In 0.4.5, the default initial deferred-data budget changes from 30 seconds to 8 seconds for both React and Preact. It starts when the hydration payload is revived; individual settlements do not restart it. For intentionally slower initial data, set deferredTimeout explicitly. This bounds silent document interruptions, not immediate disconnect detection, and does not retry loaders or mutations.

// Use the matching react/client or preact/client entry.
await mountApplication(routes, root, {
  deferredTimeout: 30_000,
});

Deferred data deadline

Initial deferred data has an 8,000 ms deadline after its hydration payload is read. A document connection can stop without firing a browser completion event; unfinished values then reject with Hydration stream timed out and reach their Await errorElement or error boundary. This is a total budget from payload revival: settlements do not restart it. It is not an inactivity timeout or a reliable disconnect detector. Set deferredTimeout to a larger millisecond budget for intentionally slow initial data (integer milliseconds from 1 through 2147483647; fractions, NaN, infinities and out-of-range values throw RangeError). There is one timer only when the initial payload contains pending values, cleared on completion or router disposal. No request or mutation is retried, and deployment recovery is not triggered. Ordinary resolved hydration creates no deadline timer.

await mountApplication(routes, root, {
  deployment,
  deferredTimeout: 60_000,
});

Fields

hash

hash?: boolean;

deployment

deployment?: DeploymentOptions | null;

deferredTimeout

deferredTimeout?: number;

Total initial deferred-data budget in integer milliseconds; not an inactivity timeout. Defaults to 8,000.

View implementation ↗