From a354fa22e076d8d91e3ed4b039207325903453d4 Mon Sep 17 00:00:00 2001 From: Vadym Vakhovskiy Date: Thu, 18 Jun 2026 16:24:26 +0200 Subject: [PATCH] fix: update reload methods to support new architecture and prevent app loop --- CHANGELOG.md | 10 ++++++++++ ios/Modules/ReactNative.swift | 25 ++++++++++++++++++------- package.json | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c69d9d..01bbb24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- We fixed an issue that could cause iOS apps to restart repeatedly after an OTA update. + +## [v0.3.3] - 2026-06-03 + +- We fixed an issue that could cause Android apps to restart repeatedly after an OTA update. + +## [v0.3.2] - Skip + +## [v0.3.1] - 2026-01-08 + - We added `SessionCookieStore` to persist, restore and clear session cookies on iOS. ## [v0.3.0] - 2025-12-09 diff --git a/ios/Modules/ReactNative.swift b/ios/Modules/ReactNative.swift index f4cc964..2788f59 100644 --- a/ios/Modules/ReactNative.swift +++ b/ios/Modules/ReactNative.swift @@ -81,12 +81,11 @@ open class ReactNative: NSObject, RCTReloadListener { // MARK: - Reload Methods public func reload() { guard let mendixApp = mendixApp else { return } - - let otaBundleUrl = OtaJSBundleFileProvider.getBundleUrl() - if !mendixApp.isDeveloperApp, let otaBundleUrl = otaBundleUrl { - RCTReloadCommandSetBundleURL(otaBundleUrl) - } - + + // Note: under the New Architecture the bundle URL is resolved fresh in bundleURL(), + // which RCTHost re-invokes on reload. RCTReloadCommandSetBundleURL is a legacy-bridge + // mechanism that the bridgeless host ignores, so it is intentionally not used here. + if mendixApp.isDeveloperApp { let runtimeInfoUrl = AppUrl.forRuntimeInfo(mendixApp.runtimeUrl.absoluteString) RuntimeInfoProvider.getRuntimeInfo(runtimeInfoUrl) { [weak self] response in @@ -153,7 +152,19 @@ open class ReactNative: NSObject, RCTReloadListener { } public func bundleURL() -> URL? { - return bundleUrl + // New Architecture (Bridgeless): RCTHost re-invokes this provider block on every + // reload (via RCTRootViewFactory's bundleURLBlock) instead of consulting the URL set + // by RCTReloadCommandSetBundleURL. Resolve the OTA bundle fresh here so a freshly + // deployed OTA bundle is picked up after reload. Without this, every reload re-loads + // the bundle captured at host-creation time and the app loops: + // download -> deploy -> reload -> same bundle. + // + // For the developer app (and remote debugging) the cached packager URL must be used, + // so only the production path re-resolves through BundleHelper. + if mendixApp?.isDeveloperApp == true { + return bundleUrl + } + return BundleHelper.getJSBundleFile() } } diff --git a/package.json b/package.json index 928a2c5..0634134 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mendix-native", - "version": "0.3.2", + "version": "0.3.3", "description": "Mendix native mobile package", "main": "./lib/module/index.js", "types": "./lib/typescript/src/index.d.ts",