Question about ComposableArchitecture 2.0 #3843
arnauddorgans
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
Yup, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I saw that
onMountreducers will be introduced. Does this mean a reducer will receive onMount automatically when it becomes active in the tree?I have multiple features composed of child features that do not own views. I need a way to trigger side effects when a reducer becomes alive, even if no view is attached to it.
Today, I handle this by defining a lifeTask action in the root feature. The root manually dispatches lifeTask to all child features. However, for optional child features that are instantiated later, I must explicitly trigger their lifeTask when they are created.
This becomes repetitive and error-prone. It would be much cleaner if onMount were automatically triggered whenever a child feature becomes active in the reducer hierarchy, regardless of whether it has an associated view.
Beta Was this translation helpful? Give feedback.
All reactions