-
In the base of our app we have a switch case to handle launch, login and main. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
You don't need to cancel actions, you need to cancel effects. Actions are sent synchronously and not cancellable. TCA's navigation tools automatically cancel effects from presented views when those views are dismissed. If you present your logged-in views using the TCA navigation tools by navigating away when the user logs out, all in-flight and long-running effects from those presented views will be cancelled. If you aren't using TCA navigation tools, yes, you need handle effect cancellation manually. (Caveat: I believe only the |
Beta Was this translation helpful? Give feedback.
-
I've actually observed, which I believe is SwiftUI bug, when using TabViews. For example if you have two tabs, Home and Settings.
If you go to the settings view and tap "Logout" the bug will make the Home view's task modifier run again before taking down the view, which in turn will send an action to the Home reducer which is not active anymore because of the state switch. |
Beta Was this translation helpful? Give feedback.
You don't need to cancel actions, you need to cancel effects. Actions are sent synchronously and not cancellable.
TCA's navigation tools automatically cancel effects from presented views when those views are dismissed. If you present your logged-in views using the TCA navigation tools by navigating away when the user logs out, all in-flight and long-running effects from those presented views will be cancelled.
If you aren't using TCA navigation tools, yes, you need handle effect cancellation manually.
(Caveat: I believe only the
ifLet
reducer tools for …