# Filter actions in scoped store

**URL:** <https://forums.swift.org/t/filter-actions-in-scoped-store/58770>\
**Category:** Swift Composable Architecture\
**Created:** [July 8, 2022, 7:54am UTC](https://forums.swift.org/t/filter-actions-in-scoped-store/58770 "2022-07-08T07:54:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![stephencelis](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/stephencelis/32/2675_2.png) [@stephencelis](https://forums.swift.org/u/stephencelis)\
**Post date:** [July 8, 2022, 10:31pm UTC](https://forums.swift.org/t/filter-actions-in-scoped-store/58770/4 "2022-07-08T22:31:25Z")

</div>

In order for a child store to be able to process a child action, it must be sent through the parent store for it to reach the app-level reducer in the first place, which is inevitably responsible for invoking the child reducer with that action internally.

While you can't prevent a parent from observing that child actions are being sent, you _can_ use access control to "hide" the contents of certain child state and actions:

```swift
public enum ChildAction {
  case actionVisibleFromParent
  case anotherActionVisibleFromParent
  case internal(Internal)

  public struct Internal {
    internal var action: Action

    internal enum Action {
      case anInternalAction
      case anotherInternalAction
    }
  }
}

```

The caveat is if you want to test these actions, they must be `internal` and not `private`, and if they are `internal` you must modularize your feature in order to prevent the parent domain from accessing them. There is also quite a bit of boilerplate, but maybe it could be eliminated with [access control for enum cases](https://forums.swift.org/t/access-control-for-enum-cases/47142).

We've generally found that this kind of hiding goes against the grain in TCA, though. Do you have a concrete, motivating use of such a pattern? Why shouldn't a parent know what their child is up to? 😉

If a child feature truly needs local domain that the parent shouldn't know about or observe at all, that domain needs to live outside of the reducer (_e.g._ as some local `@State` and action closures, or in a local TCA store that communicates with the child store).

---

_[View the full topic](https://forums.swift.org/t/filter-actions-in-scoped-store/58770)._
