From c4d727a2b810079c43cd3c72d243be94df63b86a Mon Sep 17 00:00:00 2001 From: Eulices Lopez <105620565+eulicesl@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:24:12 -0400 Subject: [PATCH] fix(ios): guard async gateway config refreshes Follow up on review feedback by re-checking the active gateway state after awaiting the permission snapshot refresh. If auto-reconnect was disabled or the active gateway changed during the async gap, the stale task now exits instead of re-applying an old config. --- apps/ios/Sources/Gateway/GatewayConnectionController.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/ios/Sources/Gateway/GatewayConnectionController.swift b/apps/ios/Sources/Gateway/GatewayConnectionController.swift index b1bbc42e0ee..309c488d632 100644 --- a/apps/ios/Sources/Gateway/GatewayConnectionController.swift +++ b/apps/ios/Sources/Gateway/GatewayConnectionController.swift @@ -241,6 +241,13 @@ final class GatewayConnectionController { bootstrapToken: cfg.bootstrapToken, password: cfg.password, nodeOptions: await self.makeConnectOptions(stableID: cfg.stableID)) + + guard appModel.gatewayAutoReconnectEnabled, + let latestConfig = appModel.activeGatewayConnectConfig, + latestConfig.effectiveStableID == cfg.effectiveStableID, + latestConfig.url == cfg.url + else { return } + appModel.applyGatewayConnectConfig(refreshedConfig) } }