Skip to content

Remove a frequentlyUsedEmojis value that is not a list from the local cache - #107639

Merged
mountiny merged 1 commit into
mainfrom
vit-clearNonArrayFrequentlyUsedEmojis
Nov 22, 2026
Merged

mountiny merged 1 commit into
mainfrom
vit-clearNonArrayFrequentlyUsedEmojis

Conversation

@mountiny

@mountiny mountiny commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Between Nov 2 and Nov 10, OpenApp sent {} for accounts with no expensify_frequentlyUsedEmojis NVP. Onyx coerced the cached [] into {}, so those devices now store an object for nvp_expensify_frequentlyUsedEmojis. Send an empty frequentlyUsedEmojis NVP as a list in OpenApp made the server send [] again, but Onyx refuses to write a list over an object. Each OpenApp and ReconnectApp on those devices now logs Trying to apply "merge" with array type to non-array type in the key "nvp_expensify_frequentlyUsedEmojis" (about 75,000 a day). Those devices also never receive the user's emoji list, so the Frequently used section in the emoji picker stops updating.

This PR adds the RemoveNonArrayFrequentlyUsedEmojis Onyx migration. When the cached value is set and is not a list, the migration removes it. The next list from the server is then stored: a full OpenApp or ReconnectApp, or the set that Auth sends when the user next uses an emoji. An incremental ReconnectApp does not resend the list. Until a list arrives, the picker shows the same empty Frequently used section it shows today with {}. These accounts had no emoji NVP when {} arrived, so no saved emojis are lost. Devices that already store a list, or nothing, are not changed. The migration is temporary and can be removed once those caches have refreshed.

Fixed Issues

$ #104824
PROPOSAL:

Tests

tests/unit/RemoveNonArrayFrequentlyUsedEmojisTest.ts covers an object, a list, and a missing value. Without the migration, the object test fails because the merged list is rejected and the value stays {}.

  1. Sign in on web in the dev environment.
  2. In the JS console, run Onyx.set('nvp_expensify_frequentlyUsedEmojis', null).then(() => Onyx.set('nvp_expensify_frequentlyUsedEmojis', {})) to put the device in the broken state.
  3. Run Onyx.log('nvp_expensify_frequentlyUsedEmojis') and verify that it prints {}.
  4. Refresh the page.
  5. Run Onyx.log('nvp_expensify_frequentlyUsedEmojis') and verify that it prints a list or undefined, not {}.
  6. Add an emoji reaction to any message.
  7. Run Onyx.log('nvp_expensify_frequentlyUsedEmojis') and verify that the list includes that emoji.
  8. Open the emoji picker and verify that the emoji appears in the Frequently used section.
  9. Verify that the console has no Trying to apply "set" with array type to non-array type or Trying to apply "merge" with array type to non-array type warning for nvp_expensify_frequentlyUsedEmojis.
  • Verify that no errors appear in the JS console

Offline tests

  1. Sign in on web in the dev environment.
  2. In the JS console, run Onyx.set('nvp_expensify_frequentlyUsedEmojis', null).then(() => Onyx.set('nvp_expensify_frequentlyUsedEmojis', {})).
  3. Turn off the network connection.
  4. Refresh the page.
  5. Run Onyx.log('nvp_expensify_frequentlyUsedEmojis') and verify that it prints undefined, not {}.
  6. Open the emoji picker and verify that it opens with no errors.
  7. Turn the network connection back on.
  8. Add an emoji reaction to any message.
  9. Run Onyx.log('nvp_expensify_frequentlyUsedEmojis') and verify that the list includes that emoji.

QA Steps

Same as tests, on web staging. window.Onyx is not available on native, so QA can only set up the broken state on web.

  • 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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.
  • 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.

Screenshots/Videos

Android: Native

Not yet tested — needs manual QA.

Android: mWeb Chrome

Not yet tested — needs manual QA.

iOS: Native

Not yet tested — needs manual QA.

iOS: mWeb Safari

Not yet tested — needs manual QA.

MacOS: Chrome / Safari

Not yet tested — needs manual QA.

@mountiny
mountiny requested review from a team as code owners November 21, 2026 02:12
@expensify-chore-bot
expensify-chore-bot Bot requested review from linhvovan29546 and trjExpensify and removed request for a team and trjExpensify November 21, 2026 02:12
@expensify-chore-bot

Copy link
Copy Markdown

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

@expensify-chore-bot
expensify-chore-bot Bot removed the request for review from a team November 21, 2026 02:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T02:15:00.033509Z a655cf2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mountiny

Copy link
Copy Markdown
Contributor Author

(Vit's agent) @MelvinBot review

@MelvinBot

MelvinBot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Web test steps verification results: ⚠️ partial

Code review found no blocking issues; all three migration unit tests passed. Browser testing confirmed sign-in, but the remaining checks were blocked by tool limitations—not observed product failures.

Signed-in web Home

Step Status
Online 1: Sign inConfirmed authenticated Home.
Signed-in web Home
✅
Online 2: Seed corrupted cacheBlocked: Onyx mutation unavailable.
❌
Online 3: Verify cached objectBlocked: Onyx inspection unavailable.
❌
Online 4: RefreshBlocked: reload prohibited by tester session conventions.
❌
Online 5: Verify array or undefinedUnverified: fixture, reload, and inspection unavailable.
❌
Online 6: React to a messageNot attempted without the corrupted-cache fixture.
❌
Online 7: Verify stored emojiBlocked: Onyx inspection unavailable.
❌
Online 8: Verify Frequently used sectionUnverified: prerequisite reaction not performed.
❌
Online 9: Check array/non-array warningsBlocked: console inspection unavailable.
❌
Online 10: Check unrelated JavaScript errorsBlocked: console inspection unavailable.
❌
Offline 1: Confirm signed-in stateConfirmed before attempting offline setup.
✅
Offline 2: Seed corrupted cacheBlocked: Onyx mutation unavailable.
❌
Offline 3: Disable networkBlocked: network toggling unavailable.
❌
Offline 4: RefreshBlocked: reload prohibited by tester session conventions.
❌
Offline 5: Verify undefined cacheUnverified: offline fixture and Onyx inspection unavailable.
❌
Offline 6: Open emoji picker without errorsUnverified under the required offline fixture.
❌
Offline 7: Reconnect networkNot performed: network was never disabled.
❌
Offline 8: React to a messageNot attempted without the offline/reconnection sequence.
❌
Offline 9: Verify stored emojiBlocked: prerequisites and Onyx inspection unavailable.
❌

view run · view recording

@mountiny
mountiny removed the request for review from linhvovan29546 November 21, 2026 02:45

// A migration runs before the app starts, so it writes to Onyx directly instead of through an action
// eslint-disable-next-line rulesdir/prefer-actions-set-data
await Onyx.set(ONYXKEYS.FREQUENTLY_USED_EMOJIS, null);

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.

NAB - Could we reformat the value instead (assuming it's not an empty object)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it will be overwritten by what comes from OpenApp eitherway

@francoisl

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
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@mountiny
mountiny merged commit 1c2acad into main Nov 22, 2026
50 of 51 checks passed
@mountiny
mountiny deleted the vit-clearNonArrayFrequentlyUsedEmojis branch November 22, 2026 04:32
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.53-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR fixes a corrupted local cache so frequently used emojis update as expected; it adds no new workflow and makes no existing article inaccurate.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/arosiclair in version: 9.5.53-3 🚀

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

Bundle Size Analysis (Sentry):

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.

4 participants