Skip to content

Stop the app review prompt from reappearing after the user answers it - #102904

Merged
marcaaron merged 5 commits into
Expensify:mainfrom
oqildev:fix/99564-app-review-prompt-loop
Oct 21, 2026
Merged

marcaaron merged 5 commits into
Expensify:mainfrom
oqildev:fix/99564-app-review-prompt-loop

Conversation

@oqildev

@oqildev oqildev commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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 negative or skip answer is nvp_appReview.lastPrompt. That key is owned by the server, the client never sends a timestamp for it (respondToProactiveAppReview sends {response, policyID}), and the value is written into optimisticData only — there is no successData for the NVP and the command answers with an empty onyxData, so the client never learns whether the answer was accepted.

Because of that, every authoritative write of nvp_appReview restores the stale timestamp and the gate in useProactiveAppReview falls back to shouldShowModal = true:

  • during sign-in the account payload lands more than once, so the modal re-opens on top of a screen that has not rendered yet;
  • Onyx.clear() on sign-out drops the optimistic value entirely, so the prompt returns on every later sign-in;
  • a fresh browser, a second device, or a ReconnectApp without updateIDFrom does the same.

This PR gives the App its own record of when it prompted:

  1. ONYXKEYS.APP_REVIEW_LAST_PROMPT — a client-owned key holding {accountID, lastPrompt}. respondToProactiveAppReview stamps it outside optimisticData, because the prompt happened whether or not the request succeeds and failureData must not roll it back. The accountID keeps it scoped, so a different user signing in on the same device does not inherit it.
  2. Both Onyx preserve lists — the record has to outlive a clear, or the next sign-in re-shows a prompt the user already answered. KEYS_TO_PRESERVE in App.ts covers reconnect and clearOnyxAndResetApp, but a user-initiated sign-out goes through signOutAndRedirectToSignIn -> redirectToSignIn -> clearStorageAndRedirect, which clears with KEYS_TO_PRESERVE_ON_SIGN_OUT in SignInRedirect.ts instead. 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_WINDOW is preserved in App.ts for the same "don't ask me again" reason.
  3. The gate now takes the newer of the server timestamp and the local record, and never falls through to "show" when a response is recorded but no timestamp can be read.

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_appReview carrying trigger, a non-positive response, and a lastPrompt older 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 past lastPrompt + 30 days, which is the same state a user reaches by waiting.

  1. Sign in with such an account.
  2. Verify the "Are you enjoying New Expensify?" modal appears — this is the intended 30-day re-prompt.
  3. Press Not really.
  4. Verify the modal closes and does not re-open while the rest of the account data finishes loading.
  5. Refresh the page and verify the modal does not appear.
  6. In the JS console run window.Onyx.log('appReviewLastPrompt') and verify it holds {accountID: <your accountID>, lastPrompt: <now>}.
  7. Sign out, sign back in, and verify the modal does not appear. (Before this change it came back on every sign-in.)
  8. Move the clock another 31 days forward, reload, and verify the modal appears again — the 30-day re-prompt is intact.
  9. Sign out, sign in with a different account on the same browser, and verify that account's own prompt state decides whether the modal shows — the record from step 6 is ignored.

Note

If you clock-shift through these steps, reload the app after setting the clock back. useProactiveAppReview snapshots 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 existing main behaviour 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.

  • Verify that no errors appear in the JS console

Offline tests

  1. Put the app offline (Settings > Troubleshoot > Force offline).
  2. With an account in the state above, trigger the prompt and press Not really.
  3. Verify the modal closes and stays closed while offline, and across a reload.
  4. Go back online and verify the queued RespondToProactiveAppReview is sent and the modal still does not re-appear.

The prompt record is written outside optimisticData on purpose, so a request that fails and rolls back nvp_appReview does 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 lastPrompt is more than 30 days old.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Automated coverage: tests/unit/useProactiveAppReviewTest.ts (10), tests/unit/ProactiveAppReviewModalManagerTest.tsx (4, new file) and tests/actions/UserTest.ts (40, unchanged) → 54/54 pass. Eight of them fail on main, including does not re-open while the stale server NVP keeps landing during sign-in and does 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

…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.
@oqildev
oqildev marked this pull request as ready for review October 3, 2026 17:54
@oqildev
oqildev requested review from a team as code owners October 3, 2026 17:54
@melvin-bot

melvin-bot Bot commented Oct 3, 2026

Copy link
Copy Markdown

@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]

@melvin-bot
melvin-bot Bot removed request for a team October 3, 2026 17:55
JmillsExpensify
JmillsExpensify previously approved these changes Oct 5, 2026

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lschurr

lschurr commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Can we merge this one @JmillsExpensify @oqildev?

@eVoloshchak

eVoloshchak commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
screen-20261021-010736-1792537635528.mp4
Android: mWeb Chrome
Screen.Recording.2026-10-20.at.22.38.12.mov
iOS: HybridApp
Screen.Recording.2026-10-21.at.00.58.15.mov
iOS: mWeb Safari
Screen.Recording.2026-10-20.at.22.30.29.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-12.at.13.24.41.mov
Screen.Recording.2026-10-20.at.22.39.26.mov

@eVoloshchak

Copy link
Copy Markdown
Contributor

Sign out, sign back in, and verify the modal does not appear. (Before this change it came back on every sign-in.)

@oqildev, this step fails for me

  1. Sign in with such a new account
  2. Submit a request to prompt the modal
  3. Verify the "Are you enjoying New Expensify?" modal appears — this is the intended 30-day re-prompt.
  4. Press Not really.
  5. Verify the modal closes and does not re-open while the rest of the account data finishes loading.
  6. Move the clock another 31 days forward, reload, and verify the modal appears again — the 30-day re-prompt is intact.
    7. Sign out, sign back in, notice the modal does appear

And it keeps appearing every time you re-login

Screen.Recording.2026-10-12.at.13.54.24.mov

Also, 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

@oqildev

oqildev commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

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.
@oqildev

oqildev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Sign out, sign back in, and verify the modal does not appear. (Before this change it came back on every sign-in.)

@oqildev, this step fails for me

  1. Sign in with such a new account
  2. Submit a request to prompt the modal
  3. Verify the "Are you enjoying New Expensify?" modal appears — this is the intended 30-day re-prompt.
  4. Press Not really.
  5. Verify the modal closes and does not re-open while the rest of the account data finishes loading.
  6. Move the clock another 31 days forward, reload, and verify the modal appears again — the 30-day re-prompt is intact.
    7. Sign out, sign back in, notice the modal does appear

And it keeps appearing every time you re-login

Screen.Recording.2026-10-12.at.13.54.24.mov

Also, 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

@eVoloshchak Good catch, thanks. I dug into it: the prompt renders before the personal details list hydrates, so I was stamping the record with CONST.DEFAULT_NUMBER_ID instead of the real account - it never matched again, and the gate kept falling back to the server's stale lastPrompt.

I fixed that in 2dedf7bc65e: I now read the accountID from the session, the same source the gate compares against. I also changed the manager tests to run against the un-hydrated shape, and three of them fail without this commit

@oqildev

oqildev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

I will add videos soon.

@oqildev

oqildev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Before fix videos:

1.

2026-11-18.at.14.30.28-compressed.mp4

2.

2026-11-18.at.18.07.00-compressed.mp4

@oqildev

oqildev commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@eVoloshchak

After fix videos:

1.

after.fix.modal-compressed.mp4

2.

after.fix.modal.with.new.account-compressed.mp4

@oqildev

oqildev commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

@eVoloshchak Ready.

@lschurr

lschurr commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Bump @eVoloshchak

@eVoloshchak eVoloshchak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@melvin-bot
melvin-bot Bot requested a review from marcaaron October 20, 2026 23:09
@marcaaron
marcaaron merged commit e8dad8b into Expensify:main Oct 21, 2026
35 of 38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 marcaaron has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcaaron in version: 9.5.20-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

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.


view run

@IuliiaHerets

Copy link
Copy Markdown

Hi @oqildev. QA team couldn't find an account that meets the preconditions.
Would it be possible to verify this internally on your side?

cc @marcaaron @JmillsExpensify @eVoloshchak

@oqildev

oqildev commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

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:

  1. Clear site data, sign in with a new account.
  2. Submit an expense, wait for the modal, press Not really.
  3. Move the machine clock 31 days forward and reload. The modal shows again, so the account now matches the preconditions.
  4. Press Not really., then sign out and sign back in. The modal should not come back.

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.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 failure ❌

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants