Composable Navigation: Effect cancellation

Episode #225 • Mar 6, 2023 • Subscriber-Only

We add superpowers to the navigation tools of the Composable Architecture, including automatically cancelling a child feature’s effects upon dismissal, and even letting child features dismiss themselves! Plus, we look at how “non-exhaustive” testing simplifies navigation-based tests.

Effect cancellation
Effect cancellation
Child dismissal
Non-exhaustive testing
Next time: unification

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.


Brandon: So things are looking pretty great already, but now we can really start to flex our muscles. Because we have this sheet reducer operator that handles all the details of how to integrate the parent and child domains, we get to layer on super powers with very little work.

Stephen: Take effect cancellation as an example. It is very common to bring up a sheet in an application, and for that sheet to fire off effects. Those effects could be long-living, like timers, socket connections, etc., or the effect may just take a long time to finish, such as a slow network request.

We would love if those effects would just be automatically torn down and canceled when the sheet is dismissed. After all, if those effects produce any actions to be fed back into the system after the sheet is dismissed, then those actions will just go into the void. The child feature can’t react to those actions because there is no state to reduce on.

Now currently, with the tools that the Composable Architecture ships today, you do get a little bit of help in this area. If your effect is started from the .task view modifier, which executes when the view appears, then that effect will be torn down when the view disappears.

However, it does not help with all of the effects that can happen at other times, such as when you tap a button to start a timer. That effect is not tied to the lifecycle of the view.

But this sheet operator we have just developed does have the capability to coordinate all of this, and it’s super cool.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in


Exhaustive testing in TCA

Krzysztof Zabłocki • Monday Mar 21, 2022

The first exploration of “non-exhaustive” testing in the Composable Architecture. This work would eventually be included in the library itself.

Composable Architecture @ Scale

Krzysztof Zabłocki • Tuesday Sep 20, 2022

An NSSpain talk in which Krzysztof covers the topic of scaling an application built in the Composable Architecture, including the use of non-exhaustive testing.

Composable navigation beta GitHub discussion

Brandon Williams & Stephen Celis • Monday Feb 27, 2023

In conjunction with the release of episode #224 we also released a beta preview of the navigation tools coming to the Composable Architecture.