From 1027a06ecd3427a9da9bbf6203e229357e61b55b Mon Sep 17 00:00:00 2001 From: Lukas Korba Date: Wed, 22 Feb 2023 11:28:15 +0100 Subject: [PATCH] [#537] Flaky navigation issue (#567) - flaky navigation reproduced and fixed --- secant/Features/Home/HomeStore.swift | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/secant/Features/Home/HomeStore.swift b/secant/Features/Home/HomeStore.swift index 8070a8b..930cd23 100644 --- a/secant/Features/Home/HomeStore.swift +++ b/secant/Features/Home/HomeStore.swift @@ -144,7 +144,12 @@ struct HomeReducer: ReducerProtocol { state.shieldedBalance = shieldedBalance.redacted } return .none - + + case .updateDestination(.profile): + state.profileState.destination = nil + state.destination = .profile + return .none + case .updateDestination(let destination): state.destination = destination return .none @@ -155,23 +160,23 @@ struct HomeReducer: ReducerProtocol { case .profile(.settings(.quickRescan)): state.destination = nil - return .task { + return .run { send in do { try await sdkSynchronizer.rewind(.quick) - return .rewindDone(true, .quickRescan) + await send(.rewindDone(true, .quickRescan)) } catch { - return .rewindDone(false, .quickRescan) + await send(.rewindDone(false, .quickRescan)) } } case .profile(.settings(.fullRescan)): state.destination = nil - return .task { + return .run { send in do { try await sdkSynchronizer.rewind(.birthday) - return .rewindDone(true, .fullRescan) + await send(.rewindDone(true, .fullRescan)) } catch { - return .rewindDone(false, .fullRescan) + await send(.rewindDone(false, .fullRescan)) } }