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
Comment |
fix: Show empty state instead of No results when default view hides all rows
…g-reports-by-policy-id # Conflicts: # src/libs/actions/OnyxDerived/configs/outstandingReportsByPolicyID.ts # src/selectors/Report.ts # tests/unit/ReportSelectorTest.ts
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
useOnyxStatehook from the Onyx branchfeature/onyx-store-useonyxstate-recut.OUTSTANDING_REPORTS_BY_POLICY_IDis computed by OnyxDerived from the report collection. On every report write the engine rebuilds the whole map, writes it back into Onyx and to disk, and hands every consumer a new object, even when the write was a chat rename that no outstanding report cares about. The consumers are the expense header actions, the expense view, the move-expense report pickers, the Search write actions and the workspace member pages, so all of them re-render on any report write.This replaces the derived value with a selector over the live report collection, read through
useOnyxState.@hooks/useOnyxswaps the report collection for the Search snapshot inside Search, anduseOnyxStatereads the store directly, so Search keeps getting live reports as it did from the derived key. The selector keeps the config's filter exactly: open or submitted expense reports that have a policy and are not pending delete, grouped by policy. It is cached on the collection reference, so every mounted consumer shares one build per write. A policy whose reports did not change keeps its previous object, and the whole map keeps its object when no policy changed, so consumers skip the re-render without a deep compare. Consumers that need every policy useuseOutstandingReportsByPolicyID; the ones that only need one policy (the workspace member pages, the approver check and the report field) useuseOutstandingReportsForPolicy, so a write in another workspace leaves them alone. The config, its key and its type are removed. The persisted row is left on disk, as with theTODOSremoval.A new reassure test runs unchanged on the base and on this branch, with 20 consumers mounted over 5,000 reports. Ten chat renames go from 11 renders (22.0 ms) to 1 (2.5 ms). Ten writes to another workspace's outstanding report take the single-workspace consumers from 11 renders (7.7 ms) to 1 (1.0 ms). The whole chat-rename write loop goes from 290 ms to 70 ms, because the engine no longer rebuilds and stores the map on every write. When an outstanding report of the consumers' workspace is approved and reopened, every consumer re-renders on both, and the time is the same within noise.
Fixed Issues
$ https://github.com/callstack-internal/expensify-issues/issues/3077
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