Reset execution state on unmount for Activity mode changes - #99197
Reset execution state on unmount for Activity mode changes#99197jmgraa wants to merge 2 commits into
Conversation
|
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 764e8c096b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| transitionHandleRef.current?.cancel(); | ||
| transitionHandleRef.current = null; | ||
| isExecutingRef.current = false; | ||
| setIsExecuting(false); |
There was a problem hiding this comment.
Prevent stale async completions from unlocking newer executions
When an async action has already reached the transition callback, its execution.finally() remains active. If Activity then hides the hook, this cleanup resets the guard; after the Activity becomes visible, a second async action can start, but completion of the first action will still call setIsExecuting(false), prematurely enabling the pressable and allowing a third invocation while the second action is pending. Invalidate completion callbacks across this reset or associate them with an execution generation.
Useful? React with 👍 / 👎.
Explanation of Change
Reset the native
useSingleExecutionstate when the hook unmounts during Activity mode changes, allowing actions to execute again after a pending transition is canceled. Added a regression test for this behavior.Fixed Issues
$ #99203
PROPOSAL:
Tests
useSingleExecutionunit tests.Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
iOS: Native