HotupdaterHot Updater
React Native API

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.

ParameterTypeRequiredDescription
bundleIdstringYesTarget artifact ID.
status"UPDATE" | "ROLLBACK"YesTransition direction.
manifestUrlstringYesTarget manifest URL.
manifestFileHashstringYesSHA256 hash or sig:<base64_signature> for the manifest.
archiveUrlstring | nullNoFull tar.br archive URL; integrity and sizes come from the verified manifest.
assetsRecord<string, ArtifactAsset>YesWithout filesUrl, the original descriptor for every target file, with optional Hermes patches. With filesUrl, only the Hermes patch, as { [path]: { patch } }.
filesUrlstring | nullNoWhere native POSTs the paths of the files it downloads one by one, for their URLs.
requestHeadersRecord<string, string> | nullNoHeaders for the filesUrl request, such as the client API key.
channelstringNoChannel committed with the staged selection.
selectionobject | nullNoRelease 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.

On this page