From 2ae2a6b494fa4b9a54d8d4efc8a797ccc61179f3 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 8 Oct 2026 17:36:42 +0900 Subject: [PATCH] =?UTF-8?q?fix(gift):=20=EC=B7=A8=EC=86=8C=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=ED=9B=84=20=EC=A0=9C=EC=B6=9C=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EB=A5=BC=20=ED=95=B4=EC=A0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V2/Gift/Detail/GiftDetailViewModel.swift | 3 ++- .../tests/check-gift-detail-cancel-loading.sh | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 work/tests/check-gift-detail-cancel-loading.sh diff --git a/SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift b/SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift index eca00a97..789355a7 100644 --- a/SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift +++ b/SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift @@ -89,8 +89,9 @@ final class GiftDetailViewModel: ObservableObject { self.hasCompletedCancellation = true self.isShowingCancelDialog = false self.onCanceled(self.applicationNo) { [weak self] didReplace in - guard let self, !didReplace else { return } + guard let self else { return } self.isCancelSubmitting = false + guard !didReplace else { return } self.fetch() } } catch { diff --git a/work/tests/check-gift-detail-cancel-loading.sh b/work/tests/check-gift-detail-cancel-loading.sh new file mode 100644 index 00000000..c4eebd6b --- /dev/null +++ b/work/tests/check-gift-detail-cancel-loading.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +ruby - "$root" <<'RUBY' +root = ARGV.fetch(0) +source = File.read(File.join(root, 'SodaLive/Sources/V2/Gift/Detail/GiftDetailViewModel.swift')) + .gsub(%r{"(?:\\.|[^"\\])*"|//[^\n]*|/\*.*?\*/}m) { |token| token.start_with?('"') ? token : '' } + .gsub(/\s+/, ' ').gsub(/\s*([(),:])\s*/, '\1').strip + +completion = source[/self\.onCanceled\(self\.applicationNo\)\s*\{ \[weak self\] didReplace in (.*?) self\.fetch\(\)\s*\}/, 1] +abort 'RED gift-detail cancel loading: cancellation completion block not found' unless completion + +reset = completion.index('self.isCancelSubmitting = false') +successful_return = completion.index('guard !didReplace else { return }') +unless reset && successful_return && reset < successful_return + abort 'RED gift-detail cancel loading: successful replacement must clear isCancelSubmitting before returning' +end + +puts 'PASS gift-detail cancel loading: successful replacement clears submission state' +RUBY