Repository navigation
Stop the app review prompt from reappearing after the user answers it - #102904
Conversation
…rs it Once an account has been prompted a second time, the only thing suppressing the modal after a negative or skipped answer is nvp_appReview.lastPrompt. The client never sends that timestamp and writes it optimistically, so every authoritative push of that server-owned key restores the stale value and the gate falls back to shouldShowModal = true. During sign-in the account payload lands more than once, so the prompt re-opens on top of an empty screen; after a sign-out Onyx.clear removes the optimistic value entirely, so it returns on every later sign-in. Keep the App's own record of when it prompted in a client-owned key, scoped to the account that wrote it and preserved across sign-out, and take the newer of that record and the server value. The 30-day re-prompt from Expensify#94936 still works, now anchored on a timestamp nothing else can clobber.
ExportOnyxStateTest requires every ONYXKEYS value to land in exactly one bucket, so a new key fails CI until someone classifies it. The record holds a prompt timestamp and the accountID that wrote it, which is the signed-in user's own ID and already present throughout an export, so it goes in safeOnyxKeys next to nvp_appReview itself.
|
@eVoloshchak 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] |
|
Can we merge this one @JmillsExpensify @oqildev? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppscreen-20261021-010736-1792537635528.mp4Android: mWeb ChromeScreen.Recording.2026-10-20.at.22.38.12.moviOS: HybridAppScreen.Recording.2026-10-21.at.00.58.15.moviOS: mWeb SafariScreen.Recording.2026-10-20.at.22.30.29.movMacOS: Chrome / SafariScreen.Recording.2026-10-12.at.13.24.41.movScreen.Recording.2026-10-20.at.22.39.26.mov |
@oqildev, this step fails for me
And it keeps appearing every time you re-login Screen.Recording.2026-10-12.at.13.54.24.movAlso, if you create a new account while clock is set 31+ days into the future, the following happens. This is a weird scenario so I'm not sure how exactly the backend handles this (and if it should at all), but I think the local key should be preventing this Screen.Recording.2026-10-12.at.13.39.02.mov |
|
Ok. I will check again. |
The prompt renders before the personal details list hydrates, so useCurrentUserPersonalDetails still returns the CONST.DEFAULT_NUMBER_ID placeholder when the user answers. The record was stamped with that 0, never matched the signed-in accountID again, and the gate fell back to the server's stale lastPrompt - so the prompt returned on every sign-in, which is what the review caught. Take the accountID from the session instead, the same source the gate compares against, and skip the write when there is no session at all. The manager tests now run with the un-hydrated personal details shape, which is the state the loop actually happens in; three of them fail without this.
@eVoloshchak Good catch, thanks. I dug into it: the prompt renders before the personal details list hydrates, so I was stamping the record with I fixed that in |
|
I will add videos soon. |
Before fix videos:1.2026-11-18.at.14.30.28-compressed.mp42.2026-11-18.at.18.07.00-compressed.mp4 |
After fix videos:1.after.fix.modal-compressed.mp42.after.fix.modal.with.new.account-compressed.mp4 |
|
@eVoloshchak Ready. |
|
Bump @eVoloshchak |
|
🚧 marcaaron 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/marcaaron in version: 9.5.20-0 🚀
|
|
No help site update is needed. This PR fixes a bug where the "Are you enjoying New Expensify?" prompt kept coming back after you answered it. No help article mentions this prompt, and the fix only makes the app do what users already expect. |
|
Hi @oqildev. QA team couldn't find an account that meets the preconditions. |
|
Hi @IuliiaHerets, you don't need an old account. A new one gets into the right state in a few minutes by moving the clock:
One thing to watch: after setting the clock back, reload before testing anything else, otherwise the modal can reopen because of the shifted time. I've verified this on web on my side. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀
Bundle Size Analysis (Sentry): |
cspell rejected "recognise" and failed the spellcheck gate.
The record was added to App.ts's KEYS_TO_PRESERVE, which only guards the reconnect and full-reset paths. User-initiated sign-out goes through signOutAndRedirectToSignIn -> redirectToSignIn -> clearStorageAndRedirect, which clears with KEYS_TO_PRESERVE_ON_SIGN_OUT instead. The record was therefore wiped on every sign-out and the prompt came back on the next sign-in, which is the loop this PR is meant to close. The regression test passed anyway because it cleared Onyx with a hand-written [APP_REVIEW_LAST_PROMPT] list, so it asserted the gate while assuming the thing under test. It now clears with the real KEYS_TO_PRESERVE_ON_SIGN_OUT and fails if the key is dropped from it.
Explanation of Change
After an account has been prompted a second time, the only thing suppressing the "Are you enjoying New Expensify?" modal for a
negativeorskipanswer isnvp_appReview.lastPrompt. That key is owned by the server, the client never sends a timestamp for it (respondToProactiveAppReviewsends{response, policyID}), and the value is written intooptimisticDataonly — there is nosuccessDatafor the NVP and the command answers with an emptyonyxData, so the client never learns whether the answer was accepted.Because of that, every authoritative write of
nvp_appReviewrestores the stale timestamp and the gate inuseProactiveAppReviewfalls back toshouldShowModal = true:Onyx.clear()on sign-out drops the optimistic value entirely, so the prompt returns on every later sign-in;ReconnectAppwithoutupdateIDFromdoes the same.This PR gives the App its own record of when it prompted:
ONYXKEYS.APP_REVIEW_LAST_PROMPT— a client-owned key holding{accountID, lastPrompt}.respondToProactiveAppReviewstamps it outsideoptimisticData, because the prompt happened whether or not the request succeeds andfailureDatamust not roll it back. TheaccountIDkeeps it scoped, so a different user signing in on the same device does not inherit it.KEYS_TO_PRESERVEinApp.tscovers reconnect andclearOnyxAndResetApp, but a user-initiated sign-out goes throughsignOutAndRedirectToSignIn->redirectToSignIn->clearStorageAndRedirect, which clears withKEYS_TO_PRESERVE_ON_SIGN_OUTinSignInRedirect.tsinstead. The key is added to both lists; the sign-out one is what closes the "it keeps appearing every time you re-login" report.NVP_LAST_DISMISSED_MARKETING_WINDOWis preserved inApp.tsfor the same "don't ask me again" reason.The 30-day re-prompt introduced in #94936 still works — it is now anchored on a timestamp nothing else can clobber. If Auth ever starts refreshing
lastPrompt, the server value is picked up automatically and the cool-down becomes account-wide instead of per-device.Fixed Issues
$ #99564
PROPOSAL: #99564 (comment)
Tests
The prompt is armed by the server, so the account has to be in the affected state:
nvp_appReviewcarryingtrigger, a non-positiveresponse, and alastPromptolder than 30 days. An account that was prompted and answered "Not really." more than 30 days ago is in exactly that state; otherwise move the machine clock pastlastPrompt + 30 days, which is the same state a user reaches by waiting.window.Onyx.log('appReviewLastPrompt')and verify it holds{accountID: <your accountID>, lastPrompt: <now>}.Note
If you clock-shift through these steps, reload the app after setting the clock back.
useProactiveAppReviewsnapshots the current time once per mount (const [timeAtMount] = useState(Date.now)) so that render stays pure. Moving the clock backwards inside a live session leaves that reference time in the future, which makes a cool-down that has only just started look 30+ days old and re-opens the modal until the next reload. This is existingmainbehaviour and reproduces without this PR — no real clock moves backwards by a month — but it is easy to trip over while testing the 31-day steps above.Offline tests
RespondToProactiveAppReviewis sent and the modal still does not re-appear.The prompt record is written outside
optimisticDataon purpose, so a request that fails and rolls backnvp_appReviewdoes not resurrect a prompt the user already answered.QA Steps
Same as tests. Note for QA: the modal cannot be summoned on a fresh account — the backend arms it, and the loop only affects accounts that were already prompted, answered non-positively, and whose stored
lastPromptis more than 30 days old.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.Automated coverage:
tests/unit/useProactiveAppReviewTest.ts(10),tests/unit/ProactiveAppReviewModalManagerTest.tsx(4, new file) andtests/actions/UserTest.ts(40, unchanged) → 54/54 pass. Eight of them fail onmain, includingdoes not re-open while the stale server NVP keeps landing during sign-inanddoes not re-open on the next sign-in after the user already answered on this device, which are the reported loop reproduced in Jest.Screenshots/Videos
Android: Native
android-native.mp4
Android: mWeb Chrome
android-mweb-.mp4
iOS: Native
ios-native-.mp4
iOS: mWeb Safari
ios-mweb___.mp4
MacOS: Chrome / Safari
web-safari.mp4
web.chrome.mp4