fix: ありがとうの送信でプッシュ通知の完了を待たない - #328
Merged
Merged
Conversation
ハーフモーダルが閉じるまでにCloud Functionsの往復を待っていたため、 送信後のローディングが長く見えていた。家事の完了通知と同じく、 ありがとうを記録できた時点で返し、通知は待たずに送る。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Collaborator
Generated by 🚫 Danger Swift against 15d4bdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
経緯
close #322
ありがとうのハーフモーダルで送信したとき、ローディングが長く表示されていた。
原因は
HouseworkListStore.sendThanksが、ありがとうをFirestoreに記録した後もプッシュ通知(Cloud Functions呼び出し)の完了をawaitで待っていたこと。モーダルはこの処理が返ってから閉じるため、通知の往復時間がそのまま待ち時間になっていた。Issueに記載のとおり、アプリが責任を持つのは「送信できたか」までとし、プッシュ通知はベストエフォートとする。
実装内容
通知の送信を
Task.detachedに移し、結果を待たずに返すようにした。ありがとうをFirestoreに記録できた時点でsendThanksが返るため、モーダルはすぐ閉じる。この形は家事の完了通知(
notifyCompleted/notifyCompletedWithComment)で既に採用しているものと同じ。ありがとうの通知だけ完了を待つ理由はなく、揃えることで「通知は待たない」という方針がStore全体で一貫する。通知が失敗したときにエラーを返さない挙動は従来どおり。送り直しても編集扱いになって通知は再送されないが、ありがとう自体は記録できているため、記録の失敗としては扱わない。
テスト
通知の到着を検証していた3件は、通知を待たなくなったことで従来の書き方では検証できなくなるため書き換えた。
completeのテストと同じくwithCheckedContinuationで通知の到着を待つ形にしたdo-catch+Issue.recordで明示的に検証する形にした確認内容
make test-packagesが通ること(6ターゲット・670件すべて通過)🤖 Generated with Claude Code