Debug Reducer, Ignoring Certain Actions #1154
rehatkathuria
started this conversation in
Ideas
Replies: 2 comments
-
Hey @rehatkathuria 👋 You could achieve this using Here's an example: struct State: Equatable { var value = "Blob" }
enum Action { case foo, bar, baz }
let reducer = Reducer<State, Action, Void>.empty.debug(
state: { $0 },
action: CasePath { $0 } extract: { action in
switch action {
case .foo, .bar: return action // debug
case .baz: return nil // ignore
}
}
) You could use this approach to create an extension that takes an |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, perfect, cheers @iampatbrown! |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Building an app that interacts with the AV layer I have a scenario where an action is being fired 60 times a second. Debugging state on this reducer is very hard to do.
I'd love to see an addition to
.debug()
where I can also pass in an argument ofAction...
to be ignored in the logsBeta Was this translation helpful? Give feedback.
All reactions