Skip to content

test: point react-native-onyx at onyx-init-hydrate branch - #98649

Draft
WojtekBoman wants to merge 1 commit into
Expensify:mainfrom
software-mansion-labs:test-onyx-init-hydrate
Draft

test: point react-native-onyx at onyx-init-hydrate branch#98649
WojtekBoman wants to merge 1 commit into
Expensify:mainfrom
software-mansion-labs:test-onyx-init-hydrate

Conversation

@WojtekBoman

Copy link
Copy Markdown
Contributor

Explanation of Change

Testing-only PR. Points the react-native-onyx dependency at the branch of Expensify/react-native-onyx#821 so ad-hoc builds can be used to validate the change on real accounts.

The Onyx change: Onyx.init() loaded the persisted database into OnyxCache through merge(), which runs fastMerge(existing, value) per key. At init time existing is always undefined, so fastMerge never merges anything - it just walks and deep-clones every nested object of every row. On a heavy account that clone-heavy cache-write phase measured ~29% of total Onyx.init() time.

PR 821 adds OnyxCache.hydrate(), a bulk-load variant used only by Onyx.init(). Values are stored by reference when safe (utils.needsNormalization(), a read-only non-allocating check for nested null/undefined and the internal replace-object mark), and fall back to the existing fastMerge path when the key already has a cache value (a cross-tab sync listener can race ahead of init) or the value needs normalizing.

Diff here is only the dependency reference:

-    "react-native-onyx": "3.0.94",
+    "react-native-onyx": "github:WojtekBoman/react-native-onyx#WojtekBoman/onyx-init-hydrate",

package-lock.json pins the exact commit (25cf1cb277bfdb12e4b2f8ee301229753d955999), so CI and ad-hoc builds install that code and nothing later.

Do not merge. Before anything ships, react-native-onyx must go back to a published version that contains the change.

Fixed Issues

$
PROPOSAL:

Tests

  1. Sign in on an account with a large amount of persisted Onyx data (heavy account).
  2. Kill and cold-start the app several times.
  3. Verify the app loads normally: LHN populates, reports open, drafts/pending actions from before the restart are still present.
  4. Open a report, send a message, kill the app before the request completes, cold start again - verify the optimistic message and its pending state survive.
  5. Switch accounts / sign out and back in - verify no stale data from the previous account.
  6. Web only: open the app in two tabs, cold-start one tab while the other is writing (send a message in tab B during tab A's load) - verify no lost or duplicated data in either tab.
  7. Verify no console errors from Onyx during startup.
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. Send a message / create an expense so pending actions are queued.
  3. Kill the app, cold start while still offline - verify queued actions and offline data are intact.
  4. Go online - verify queued actions flush and data reconciles.

QA Steps

Same as Tests above - primary goal is to confirm no data-integrity or startup regression on cold start with a heavy account.

  • Verify that no errors appear in the JS console

PR Author Checklist

Screenshots/Videos

N/A - no UI change.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@github-actions

Copy link
Copy Markdown
Contributor

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

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.

1 participant