Skip to content

Commit d165966

Browse files
authored
Don't print to console when dumping state for ViewStore.debug (#829)
1 parent fa4fa76 commit d165966

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ public struct WithViewStore<State, Action, Content> {
6363
fileprivate var _body: Content {
6464
#if DEBUG
6565
if let prefix = self.prefix {
66+
var stateDump = ""
67+
customDump(self.viewStore.state, to: &stateDump, indent: 2)
6668
let difference =
6769
self.previousState(self.viewStore.state)
6870
.map {
6971
diff($0, self.viewStore.state).map { "(Changed state)\n\($0)" }
7072
?? "(No difference in state detected)"
7173
}
72-
?? "(Initial state)\n\(customDump(self.viewStore.state, indent: 2))"
74+
?? "(Initial state)\n\(stateDump)"
7375
func typeName(_ type: Any.Type) -> String {
7476
var name = String(reflecting: type)
7577
if let index = name.firstIndex(of: ".") {

0 commit comments

Comments
 (0)