Skip to content

Commit c1218e9

Browse files
committed
wip
1 parent 6123c91 commit c1218e9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Sources/ComposableArchitecture/Reducer/Reducers/StackReducer.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,29 @@ public struct _StackReducer<
264264
.map { toStackAction.embed(.element(id: elementID, action: $0)) }
265265
._cancellable(navigationIDPath: elementNavigationIDPath)
266266
} else {
267-
runtimeWarn("TODO")
267+
runtimeWarn(
268+
"""
269+
A "forEach" at "\(self.fileID):\(self.line)" received an action for a missing element.
270+
271+
Action:
272+
\(debugCaseOutput(destinationAction))
273+
274+
This is generally considered an application logic error, and can happen for a few reasons:
275+
276+
• A parent reducer removed an element with this ID before this reducer ran. This reducer \
277+
must run before any other reducer removes an element, which ensures that element
278+
reducers can handle their actions while their state is still available.
279+
280+
• An in-flight effect emitted this action when state contained no element at this ID. \
281+
While it may be perfectly reasonable to ignore this action, consider canceling the \
282+
associated effect before an element is removed, especially if it is a long-living effect.
283+
284+
• This action was sent to the store while its state contained no element at this ID. To \
285+
fix this make sure that actions for this reducer can only be sent from a view store when \
286+
its state contains an element at this id. In SwiftUI applications, use \
287+
"NavigationStackStore".
288+
"""
289+
)
268290
destinationEffects = .none
269291
}
270292

0 commit comments

Comments
 (0)