Repository navigation
[NoQA][Insights] Support Average on Compliance charts and update tooltip contents - #105933
luacmartins merged 8 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cad4ba39ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ...chartQuery, | ||
| snapshot: chartQuery.queryJSON ? snapshots[chartQuery.queryJSON.hash] : undefined, | ||
| previousPeriodSnapshot: chartQuery.previousPeriodQueryJSON ? snapshots[chartQuery.previousPeriodQueryJSON.hash] : undefined, | ||
| average: {[CONST.SEARCH.CHART_METRIC.AMOUNT]: graph?.averageAmount, [CONST.SEARCH.CHART_METRIC.COUNT]: graph?.averageCount}, |
There was a problem hiding this comment.
Preserve cached averages across the field rename
When an existing install opens a cached Insights response after this upgrade while offline, the persisted graph still has the pre-change average field, but this line creates a truthy {amount: undefined, count: undefined} instead of falling back or returning undefined. useInsightsChartData then treats Average mode as active and InsightsChartWidget converts the category pie to a bar, while buildChartSeries has no averageValue and draws no average line, so the previously working cached Spend comparison disappears until a refresh. Preserve average as an amount fallback (or migrate stored records), and leave the comparison undefined when the selected metric is unavailable.
AGENTS.md reference: AGENTS.md:L97-L102
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
yeah, the always truthy object was a bug, fixed. average mode now checks the average for the chart's metric, so the chart keeps its own view when that average is missing. though I'd skip the fallback for the old average field, since a cached response gets replaced on the next fetch
|
🚧 JmillsExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
JmillsExpensify
left a comment
There was a problem hiding this comment.
I like what I'm seeing so far, though probably should come back to this PR once we get the PR for the main graphs merged.
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / SafariScreen.Recording.2026-11-06.at.14.02.20.mov |
|
🚧 luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.5.35-0 🚀
|
|
No FullStory changes needed — this PR fixes the existing Average comparison on Compliance charts and reformats existing tooltip values without adding new screens or user interactions. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.35-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The backend now returns
averageAmountandaverageCountfor each Insights graph in place ofaverage. Each chart draws the average of the metric it plots: amount charts draw averageAmount and count charts draw averageCount, which makes the Average compare mode work on Compliance.Compliance tooltips follow the format agreed in #105265 (comment). With a comparison, each row reads "22 expenses (34%) · $420.42", where the percentage is the share of submitted expenses that have violations. Without one, the amount goes on its own line, as the expense count does on Spend.
The tooltip props are reshaped into one
TooltipValuetype (value, percentage, secondaryValue), and the chart average is keyed by metric.Fixed Issues
$ #102808
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
No tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
Nagranie.z.ekranu.2026-11-5.o.14.49.26.mov