Skip to content

Commit 2f50bb6

Browse files
committed
Notify UI on dialog dismissal to manage refund state transitions
1 parent 8eb7f5b commit 2f50bb6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosIssueRefundDialog.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fun WooPosIssueRefundDialog(
6363

6464
val handleDismiss = {
6565
if (viewModel.onDismissRequest()) {
66+
viewModel.onUIEvent(WooPosRefundUIEvent.DialogDismissed)
6667
onDismissRequest()
6768
}
6869
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosRefundViewModel.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ class WooPosRefundViewModel @AssistedInject constructor(
123123
when (event) {
124124
WooPosRefundUIEvent.DialogDismissed -> {
125125
val currentState = _state.value
126-
val isProcessing = currentState is WooPosRefundState.Content &&
127-
currentState.step == WooPosRefundState.Content.RefundStep.Processing
128126

129-
// Only reset state if not processing (i.e., dismissal was allowed)
130-
if (!isProcessing) {
131-
loadRefundableItems()
127+
128+
if (currentState is WooPosRefundState.Content &&
129+
currentState.step != WooPosRefundState.Content.RefundStep.Processing) {
130+
_state.value = currentState.copy(step = WooPosRefundState.Content.RefundStep.SelectItems)
132131
}
133132
}
134133
else -> {

0 commit comments

Comments
 (0)