updateBundle
Stage a selected transition without reloading the current React Native runtime.
Usage
Use the pre-filled updateBundle() helper returned by checkForUpdate(). It
resolves the update's manifest, stages the selected transition, and does not
reload the currently running React Native runtime.
import { HotUpdater } from "@hot-updater/react-native";
export const hotUpdater = HotUpdater.init({
baseURL: "<your-update-server-url>",
requestHeaders: { "x-api-key": "<client-api-key>" },
onError: (error) => console.error("Hot Updater:", error),
});
async function stageAppUpdate() {
const updateInfo = await hotUpdater.checkForUpdate({
updateStrategy: "appVersion",
});
if (!updateInfo) return;
const didUpdate = await updateInfo.updateBundle();
if (didUpdate && updateInfo.shouldForceUpdate) {
await hotUpdater.reload();
}
}Direct parameters
Most apps should not construct these parameters. The selected update helper supplies them after resolving the artifact endpoint.
| Parameter | Type | Required | Description |
|---|---|---|---|
bundleId | string | Yes | Target artifact ID. |
status | "UPDATE" | "ROLLBACK" | Yes | Transition direction. |
manifestUrl | string | Yes | Target manifest URL. |
manifestFileHash | string | Yes | SHA256 hash or sig:<base64_signature> for the manifest. |
archiveUrl | string | null | No | Full tar.br archive URL; integrity and sizes come from the verified manifest. |
assets | Record<string, ArtifactAsset> | Yes | Without filesUrl, the original descriptor for every target file, with optional Hermes patches. With filesUrl, only the Hermes patch, as { [path]: { patch } }. |
filesUrl | string | null | No | Where native POSTs the paths of the files it downloads one by one, for their URLs. |
requestHeaders | Record<string, string> | null | No | Headers for the filesUrl request, such as the client API key. |
channel | string | No | Channel committed with the staged selection. |
selection | object | null | No | Release Catalog selection receipt. |
The runtime downloads and verifies the manifest, then reuses matching current
OTA or built-in files. On Android, a release build re-encodes PNGs (AAPT2's
crunchPngs), so a built-in image no longer has the OTA's bytes: the native
build records each asset's source hash, and the first OTA reuses a built-in
asset whose source matches. For remaining files, it can choose a full archive
based on download cost when archiveUrl is available, where each file beyond
16 parallel downloads also costs a round trip. Otherwise it tries an optional
Hermes patch, then the complete original file. An archive failure falls back to
individual files; a patch failure falls back to the original file. The staged
directory is committed atomically only after every target hash is verified.
updateBundle never reloads the app by itself. Call hotUpdater.reload() to
start the staged transition immediately.
For a built-in Catalog transition, use the helper returned by
checkForUpdate(); that transition does not require a fabricated manifest
request.