Skip to content

Commit e27b1ab

Browse files
committed
Prevent sending discard suggestion action when there is no suggestion displayed
1 parent 986afee commit e27b1ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Core/Sources/SuggestionWidget/SuggestionWidgetController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ public extension SuggestionWidgetController {
5151
}
5252

5353
func discardSuggestion() {
54-
store.send(.panel(.discardSuggestion))
54+
store.withState { state in
55+
if state.panelState.content.suggestion != nil {
56+
store.send(.panel(.discardSuggestion))
57+
}
58+
}
5559
}
5660

5761
#warning("TODO: Make a progress controller that doesn't use TCA.")

0 commit comments

Comments
 (0)