Skip to content

Commit

Permalink
perf: improve validating service
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed May 12, 2024
1 parent 6525990 commit ae828a2
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ struct ServiceConfigurationSecretSectionView<Content: View>: View {
DispatchQueue.main.async {
guard viewModel.isValidating else { return }

var error = error

// If error is nil but result text is also empty, we should report error.
if error == nil, (result.translatedText?.isEmpty) == nil {
error = EZError(type: .API)
}

viewModel.isValidating = false
viewModel
.alertTitle = (error == nil)
Expand Down

0 comments on commit ae828a2

Please sign in to comment.