Repository navigation
[CP Stg] Fix overlapping submit buttons after cancelling PDF generation - #105297
Conversation
Use the real Reanimated web exit implementation rather than the shared mock, which removes exiting views immediately. The regression assertion fails before the fix because the loading button survives beside the restored submit dropdown.
Run the completed-submission shrink/fade explicitly instead of using an exiting layout animation. Unmounting on PDF cancellation must remove the loader immediately rather than retaining it beside the restored button. Cancel in-flight timing animations during cleanup. The previously failing real-web-renderer regression now passes. Add coverage for delayed cancellation and stopping a mounted button. Verified 40 targeted Jest tests and Playwright cancellation/completion. Changed-file lint, spelling, and React Compiler checks pass. Full typecheck has existing camera, Onyx, and tooling dependency failures.
Replace the timing-based shrink/fade with Reanimated CSS keyframes and onCSSAnimationEnd. Cancelled submissions unmount immediately without retaining an exiting view or invoking the completion callback. Honor reduced motion with a zero-duration CSS animation. Keep the real-web exit regression and add CSS callback, reduced-motion, and mid-animation cancellation coverage. Enable fake timers explicitly because the shared Jest setup restores real timers. Verified 43 targeted tests and Playwright cancellation, normal completion, reduced-motion completion, and cancellation during the CSS fade. Lint, spelling, formatting, and React Compiler checks pass. Full typecheck still has baseline dependency errors, with none in changed files.
Reset animation state by mounting a keyed active child instead of copying the running prop into state in an Effect. Derive DEW loading from metadata, remember failures during render, and move the Submitted display delay into CSS. Remove redundant width measurement and ref reads. Keep Effects only for a cancellable loading timer and acknowledgement of failed submissions in the external Onyx store. Add restart, report-switch, DEW loading, and failure-acknowledgement coverage. All 47 targeted tests pass. Playwright verifies cancellation, completion, reduced motion, and cancellation during the fade. Oxfmt, lint, spelling, and React Compiler checks pass. Full typecheck retains baseline dependency errors with none in changed files.
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
The real-web animation regression imports @testing-library/dom directly, but the package was only available as a transitive dependency. Declare the already-locked 10.4.2 version as a dev dependency so Knip and npm ci recognize the import without changing dependency resolutions. Knip comparison introduces zero new findings; 47 targeted tests pass.
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. |
| </Animated.View> | ||
| )} | ||
| {!isAnimationRunning && ( | ||
| <Animated.View style={[styles.justifyContentCenter, {height: variables.componentSizeNormal}]}> |
There was a problem hiding this comment.
❌ UI-3 (docs)
The outer container passes an inline style object literal {height: variables.componentSizeNormal} to the style prop. This is a static value (a design token), not an animated reanimated style nor a value that must be computed at render time, so it belongs in the shared style system. Inline object literals create a new object every render and bypass theming. A styles.componentSizeNormal (height + width) helper already exists in src/styles/index.ts.
Move the static height into the style system instead of an inline object. For example, add a height-only token to styles and reference it:
<Animated.View style={[styles.justifyContentCenter, styles.componentHeightNormal]}>where componentHeightNormal is defined in src/styles/index.ts as {height: variables.componentSizeNormal}.
Reviewed at: 3efd13e | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-10-28.at.10.11.38.PM.movAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-10-28.at.10.04.58.PM.mov |
| </Animated.View> | ||
| )} | ||
| {!isAnimationRunning && ( | ||
| <Animated.View style={[styles.justifyContentCenter, {height: variables.componentSizeNormal}]}> |
There was a problem hiding this comment.
Outer Animated.View no longer animates anything
The animation moved to the inner view and containerStyles is gone, so this wrapper only has static styles.
Use a plain View.
| View: jest.fn((props: React.ComponentProps<typeof WebView>) => <WebView {...props} />), | ||
| }, | ||
| // Jest does not compile app worklets. Keep the real web hook with explicit dependencies. | ||
| useAnimatedStyle: (updater: Parameters<typeof actual.useAnimatedStyle>[0]) => actual.useAnimatedStyle(updater, [updater]), |
There was a problem hiding this comment.
Test still mocks useAnimatedStyle
The component no longer calls useAnimatedStyle, so this mock does nothing.
|
issue not reproduce in web and iOS, v9.5.24-5 PR:105297 Ad-Hoc (Step 8: green loading button disappears and is replaced by Submit PDF button, Not Submit button) Screen.Recording.2026-10-29.at.4.49.16.AM.movScreenRecording_10-29-2026.04-52-43_1.MP4 |
If this is expected behavior, all good |
mkhutornyi
left a comment
There was a problem hiding this comment.
Please check nab comments
|
On Android:
Not blocking on this though Screen.Recording.2026-10-28.at.10.12.45.PM.mov |
…tion [CP Stg] Fix overlapping submit buttons after cancelling PDF generation (cherry picked from commit 9387bba) (cherry-picked to staging by jasperhuangg)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 jasperhuangg has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🔁 Filed a Staging retest request for deploy blockers #105206 after this PR was cherry-picked to staging. |
|
🚀 Cherry-picked to staging by https://github.com/jasperhuangg in version: 9.5.24-8 🚀
|
|
No help site update needed. This PR fixes an animation glitch where the old loading button stayed visible after you dismissed the Generate PDF modal. The app now behaves the way users already expect, so no article sentence is wrong. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.24-8 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/jasperhuangg in version: 9.5.25-0 🚀
|
|
No help site update needed. This PR fixes an animation glitch where the old loading button stayed visible after you dismissed the Generate PDF modal. The app now behaves the way users already expect, so no article sentence is wrong. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.25-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Cancelling Submit via PDF could leave the old green loading button visible beside the restored Submit dropdown. #105222 starts cleanup earlier, but the Reanimated exiting animation still outlives the fading modal.
Replace that unmount-driven animation with Reanimated 4 CSS keyframes. The mounted submission animation owns the shrink/fade and finishes through
onCSSAnimationEnd; cancelling unmounts the old view immediately instead of animating a retained clone. Keep the Submitted display delay in CSS and respect reduced motion.Removed inappropriate/unnecessary effects as part of the refactor:
Add a component regression that renders the real Reanimated web exit implementation. It failed before the fix because both buttons remained in the DOM. Additional cases cover completion callbacks, cancellation, reduced motion, restarting, report changes, and DEW success/failure state.
AI tests
Passed: 47 targeted Jest tests across five suites:
npm test -- --runInBand \ tests/ui/components/AnimatedSubmitButtonTest.tsx \ tests/ui/components/SubmitActionButtonTest.tsx \ tests/unit/components/FileDownloadModalWrapperTest.tsx \ tests/unit/hooks/useReportPDFDownloadModalTest.tsx \ tests/unit/hooks/useExpensifyCardStatementPDFDownloadModalTest.tsxPassed: changed-file lint, spelling, React Compiler compliance, scoped
oxfmt --check, andagents sync --check.Full typecheck remains blocked by pre-existing camera, Onyx, and tooling dependency/type errors; no diagnostics refer to either changed file.
Playwright desktop Chrome: three unthrottled dismissals showed zero overlapping frames. Also verified the normal animated completion, reduced-motion completion, and cancellation during the CSS fade.
The browser used this branch's local frontend with the staging API through a browser-only asset override; this is not a staging deployment.
Environment limitation: the browser console contains dev-server HMR WebSocket errors and staging PDF-fetch CORS errors. No clean-console or PDF-content-validation claim is made. Native/mobile, offline, and high-traffic-account verification have not been performed.
Reproduction/verification flow used by the AI:
Fixed Issues
$ #105206
Tests
Offline tests
None.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
issue-105206-approved-fix.webm