-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add support for recursive field reference resolution in formula fields #79825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change enables formula fields to recursively resolve field references when computing values. When a field's default value contains {field:X} references, the system now:
- Parses the default value to detect field references
- Recursively computes referenced field values using their current default values
- Ignores stale 'value' properties when resolving dependencies
- Supports multi-level chaining (e.g., C -> A -> B)
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@ikevin127 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] |
src/components/MoneyRequestReportView/MoneyRequestViewReportFields.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a34a8e9e0
ℹ️ 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".
- Extract field value resolution into resolveReportFieldValue helper in Formula library - Add circular reference prevention for field dependencies - Combine getReportFieldValues and getReportFieldsByName into single getReportFieldMaps function - Optimize field map generation with single-pass iteration - Add quick string check before expensive formula parsing
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.mp4Android: mWeb Chromeandroid-mweb.mp4iOS: HybridAppios.moviOS: mWeb Safariios-mweb.movMacOS: Chrome / Safariweb.mov |
ikevin127
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Completed reviewer checklist - changes look good, only have 2 comments.
|
@ikevin127 thanks for review. It's ready now |
ikevin127
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM - Thanks for the changes!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.3.6-0 🚀
|
Explanation of Change
Fixed Issues
$ #74651
PROPOSAL: #74651 (comment)
Tests
Verify both changes to the same value without any page refresh
Verify that no errors appear in the JS console
Offline tests
QA Steps
The same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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_native.mp4
Android: mWeb Chrome
android_mWeb.mp4
iOS: Native
https://github.com/user-attachments/assets/a488a849-0895-4428-a8ea-f29597dbd293iOS: mWeb Safari
ios_mWeb.mp4
MacOS: Chrome / Safari
web.mp4