Allow pendingAction and pendingFields to be merged into search snapshots even when those keys were not previously present#723
Conversation
…ots even when those keys were not previously present
|
All contributors have signed the CLA ✍️ ✅ |
|
@eVoloshchak, this is my first pr in this repo. Where do I need to test and create records for? Could you please give a little details on every section of the checklist? thanks. |
|
I have read the CLA Document and I hereby sign the CLA |
|
Hi @marufsharifi Do you plan to move ahead with this PR? In general it isn't a good direction because we are introducing Expensify product-specific logic into Onyx. |
|
@luacmartins, waiting for your thoughts on this. |
|
I think the way to do this would be to expose a config to App and pass the keys we want to merge regardless via that config prop. |
|
Yeah, I agree that a config option would be a better route to go. |
|
Could you explain me what's the reason behind this change? Is there a discussion or thread where I could find the proposal/idea? |
|
@fabioh8010, please check this PR. |
|
@fabioh8010, @luacmartins, just to confirm, should i procced with this PR? Thanks. |
|
@marufsharifi Could you elaborate a formal proposal how you plan to make this change in Onyx, so everyone is aligned about the RCA and solution? |
@fabioh8010, should I post the proposal in this Pr? Thanks. |
|
It's ok for me, @luacmartins @tgolen do you agree? |
|
Sure |
|
@marufsharifi Any news here? |
ProposalPlease re-state the problem that we are trying to solve in this issue.When deleting expenses from search while offline, the UI doesn’t show the correct “pending delete” state because search results come from snapshot data that doesn’t include What is the root cause of that problem?Onyx snapshot merging only copies keys that already exist in the snapshot object. Since What changes do you think we should make in order to solve the problem?Add a configurable allowlist of keys that should always be merged into snapshot entries, even if missing. Expose this config at Onyx initialization so App can opt in to merging What alternative solutions did you explore? (Optional) |
|
finalizing the pr. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e93c687394
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@fabioh8010, could you please share a guide for the PR checklist in this repo? |
|
I will review it soon |
fabioh8010
left a comment
There was a problem hiding this comment.
Some comments
About the proposal -> LGTM
|
@fabioh8010, please take another look when you get a chance, i've addressed your feedback. |
tgolen
left a comment
There was a problem hiding this comment.
Thanks! The comments are better now.
|
@fabioh8010, could you please check this comment? thanks. |
|
@marufsharifi lint is failing |
@marufsharifi You basically need to fill the sections/checklist as usual, like you do for E/App PRs. In Automated Tests you should specify whether you added unit tests, and in case none were added it should have a justification for that. In Manual Tests you are going to put the test plan that proves the PR it's fixing, same as E/App. In Screenshots/Videos you attach the media related to your manual tests. |
322c9d3
|
There was a prettier failure I fixed, and it dismissed all the reviews. @luacmartins, could you please check again and merge? Thanks. cc @tgolen, @mjasikowski |
Details
Added
snapshotMergeKeystoOnyx.initoptions and global settings so apps can opt in to extra snapshot fields without hardcoding app-specific keys in Onyx.Updated
updateSnapshotsto merge existing snapshot keys plus configured allowlist keys (if present on the updated value).Added unit test coverage to verify that allowlisted keys are merged into snapshots even when missing originally.
Related Issues
Expensify/App#69559
Automated Tests
Added required unit tests.
Manual Tests
Author Checklist
### Related Issuessection aboveTestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)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
MacOS: Desktop
Screen.Recording.1404-11-15.at.5.44.57.PM.mov