Conversation
|
Someone is attempting to deploy a commit to the Code for Japan Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Closes #522
概要
Quest の書き込み系フックが
catchでエラーを握りつぶしていたため、wallet で署名を拒否しても、コントラクトが revert しても、RPC がタイムアウトしても、UI は「承認しました」等の成功 toast を表示していました。オペレータから見ると「承認したはずなのに Kanban が動かない」状態になります。ルート側(
app/routes/$treeId_.quest.$questId.tsx)は既にと正しく書かれていました。フックが例外を飲み込んで
undefinedを resolve していたため、このcatchに到達できなかったのが原因です。変更内容
1. 5つの書き込みフックから
catchを削除useSubmitQuestCompletionuseWithdrawQuestSubmissionuseRejectQuestSubmissionuseApproveQuestuseCancelQuestfinally { setIsLoading(false) }は残しているので、ローディング状態の解除は従来どおりです。呼び出し側は変更していません(既に正しい形のため)。2. 早期 return を throw に変更(2つ目の silent success)
このガードも
catchと同じ問題を起こします。ボタン自体がワークスペース解決後にしか描画されないので、ここに落ちるのは状態ではなくバグです。共通ヘルパーrequireQuestWriteContextに切り出し、throw するようにしました。戻り値で型が narrow されるため、各フック内のwallet/moduleAddressの扱いは従来と同じです。3. テスト追加
requireQuestWriteContextの 3 ケースをuseHatsQuestModule.test.tsに追加しました(アドレス欠落 / wallet 欠落 / 正常系)。変更していない箇所
useCreateQuestのcatchはそのままです。こちらは{ questIds, requested, error }を返してバッチの部分成功を呼び出し元に伝える設計で、呼び出し側($treeId_.$hatId_.$address_.quest.new.tsx)もcreated < countを見て「◯件作成しました(残り◯件は失敗)」と出し分けています。動作確認
pnpm frontend test(40 passed)pnpm frontend typecheckpnpm biome:checkfollow-up の提案
Issue の Requirements にある「他のフックにも同様のパターンがないか確認」の結果です。同じ握りつぶしが以下に残っています。スコープが広がるため本 PR には含めていませんが、別 Issue を立てて対応してよければ起票します。
hooks/useScheduledDistributor.tshooks/useSplitsCreator.tshooks/useHats.tshooks/useFractionToken.tshooks/useThanksToken.tsただし呼び出し側が
catchを持っているとは限らないので、フックだけ直すと無音の失敗が未ハンドル例外に変わります。フック修正とルート側の toast 対応はセットで進めるのが安全だと思います。