Guard success-path setState with mounted check in review send#525
Conversation
The blocking submit (#524) widens the unmount window while awaiting the RPC. If the screen unmounts mid-submission, the unguarded setState threw and was caught by the failure handler, reporting a successful send as failed and skipping navigation to the success screen.
dewabisma
left a comment
There was a problem hiding this comment.
Actually, this is redundant checking the mounted. As you can see on line 62, we already checked it.
And after seeing it, it's kinda weird we set state on not mounted.
|
@dewabisma The line 62 Between line 62 and the success
The widget can unmount during that On the second point — The removed |
|
This is a small thing we can just fix it and move on |
|
AI explanation above ;) |
Summary
Follow-up to #524. Now that the send flow blocks on the RPC submission before navigating, the await in
_confirmSendcan take a real network round-trip (plus retries). This widens the window for the screen to unmount mid-submission.The success-path
setStatewas not guarded bymounted. If the widget unmounted during submission, thatsetStatethrew, the exception was caught by the failure handler, and a successful send was reported as failed (sendReviewSubmitFailed) while navigation to the success screen was skipped.This adds an early
if (!mounted) return;before the successsetStateand removes the now-redundantif (mounted)wrapper aroundNavigator.push(no awaits between the guard and the push). The failure handler already guards itssetStatewithmounted.Test plan
setState after dispose, no false failure logged.