Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
This targets the Onyx store bump in Expensify#98956 and builds on the unmerged
useOnyxStatefrom react-native-onyx.ONE_ON_ONE_CHAT_REPORT_IDSis an OnyxDerived index from participant set to the reportID of its 1:1 chat. It exists so the expense confirmation page can find the existing chat with the recipient without scanning every report when it mounts. That page is its only reader, but the engine keeps the index up to date on every report write for the whole life of the app, and writes it back into Onyx and to disk each time.This removes the derived value. The page now asks
useOneOnOneChatReportIDfor the one chat it needs. The hook reads the report collection and the session withuseOnyxState, live, so the Search snapshot never applies, as before. The lookup walks the collection once per report write while the page is mounted, skips reports that do not contain both participants before running the 1:1 checks, and caches the answer on the collection snapshot, so the page's many re-renders between writes cost a map lookup. The answer is the same as the index: the first 1:1 or system chat in collection order with exactly those participants. While an optimistic DM and the real one share participants, the optimistic one stays the answer until it is removed, then the real one takes over. One edge case now followsgetChatByParticipantsrather than the order in which reports arrived: if a report earlier in the collection becomes a 1:1 chat for participants that a later chat already covers, the earlier one is returned. The config, its key and its type are removed. The persisted row is left on disk, as with theTODOSremoval.A new reassure test mounts the real confirmation page over 5,000 reports, unchanged on the base and on this branch. Mounting stays the same within noise (25.2 ms on the base, 25.7 ms here, after every report was replaced). Ten report writes with the page closed take 39 ms instead of 60 ms, and with the page open 202 ms instead of 211 ms. A first version that rebuilt the whole index on mount made the mount 40% slower, which is why the lookup searches for one chat instead.
Fixed Issues
$ https://github.com/callstack-internal/expensify-issues/issues/3079
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
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.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari