File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Core/Sources/SuggestionWidget/FeatureReducers Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ public struct PromptToCodeGroup {
1919 }
2020 set {
2121 selectedTabId = newValue? . id
22+ if let id = selectedTabId {
23+ promptToCodes [ id: id] = newValue
24+ }
2225 }
2326 }
2427 }
@@ -88,7 +91,13 @@ public struct PromptToCodeGroup {
8891 return . none
8992
9093 case let . discardAcceptedPromptToCodeIfNotContinuous( id) :
91- state. promptToCodes. removeAll { $0. id == id && $0. hasEnded }
94+ for itemId in state. promptToCodes. ids {
95+ if itemId == id, state. promptToCodes [ id: itemId] ? . clickedButton == . accept {
96+ state. promptToCodes. remove ( id: itemId)
97+ } else {
98+ state. promptToCodes [ id: itemId] ? . clickedButton = nil
99+ }
100+ }
92101 return . none
93102
94103 case let . updateActivePromptToCode( documentURL) :
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ public struct PromptToCodePanel {
1717 public enum FocusField : Equatable {
1818 case textField
1919 }
20+
21+ public enum ClickedButton : Equatable {
22+ case accept
23+ case acceptAndContinue
24+ }
2025
2126 @Shared public var promptToCodeState : ModificationState
2227 @ObservationStateIgnored
@@ -36,7 +41,7 @@ public struct PromptToCodePanel {
3641
3742 public var generateDescriptionRequirement : Bool
3843
39- public var hasEnded = false
44+ public var clickedButton : ClickedButton ?
4045
4146 public var isActiveDocument : Bool = false
4247
@@ -250,13 +255,14 @@ public struct PromptToCodePanel {
250255 return . cancel( id: CancellationKey . modifyCode ( state. id) )
251256
252257 case . acceptButtonTapped:
253- state. hasEnded = true
258+ state. clickedButton = . accept
254259 return . run { _ in
255260 await commandHandler. acceptModification ( )
256261 activatePreviousActiveXcode ( )
257262 }
258263
259264 case . acceptAndContinueButtonTapped:
265+ state. clickedButton = . acceptAndContinue
260266 return . run { _ in
261267 await commandHandler. acceptModification ( )
262268 activateThisApp ( )
You can’t perform that action at this time.
0 commit comments