diff --git a/Sources/Hub/HubApi.swift b/Sources/Hub/HubApi.swift index 59ec26a..47d40b9 100644 --- a/Sources/Hub/HubApi.swift +++ b/Sources/Hub/HubApi.swift @@ -801,6 +801,13 @@ extension HubApi { } monitor.start(queue: queue) + + // Seed initial state immediately to avoid a startup race + // where the default value (`isConnected == false`) + // is read before the first `pathUpdateHandler` callback fires. + Task { + await self.state.update(path: self.monitor.currentPath) + } } func stopMonitoring() {