-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Remove Onyx.connect() for the key: ONYXKEYS.ACCOUNT in src/libs/actions/Delegate.ts #68979
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
| let account: OnyxEntry<Account>; | ||
| // Authentication lib is not connected to any changes on the UI | ||
| // So it is okay to use connectWithoutView here. | ||
| Onyx.connectWithoutView({ |
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.
@ikevin127 , please check this thread for more info:
https://new.expensify.com//r/5512877217123728/7684504551749862656
We decided to use connectWithoutView for this particular lib
|
Currently working on Unit tests |
|
@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] |
|
|
| close(() => setShouldShowOfflineModal(true)); | ||
| return; | ||
| } | ||
| connect(email); | ||
| connect({email, delegatedAccess: account?.delegatedAccess}); |
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.
NAB: 🟡 Potential silent no-op when delegatedAccess is not yet available:
- if
account?.delegatedAccessisundefined(e.g., early in app startup),connect()returns early by design and nothing happens. From the user perspective: taps “Switch account” do nothing without feedback. - suggested UI guard to prevent a confusing UX, add
disabledtocreateBaseMenuItem:
badgeText: translate('delegate.role', {role}),
+ disabled: !!account?.delegatedAccess,
onSelected: () => {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.
@ikevin127 AFAIK, we don't have the switcher shown on the UI unless we have account object present, please correct me if i am wrong
src/pages/settings/Security/AddDelegate/UpdateDelegateRole/UpdateDelegateRolePage.tsx
Outdated
Show resolved
Hide resolved
...s/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/BaseValidateCodeForm.tsx
Show resolved
Hide resolved
| }); | ||
| }); | ||
| }); | ||
| describe('isConnectedAsDelegate', () => { |
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.
🟢 Could use a test for the “no delegatedAccess” early-return to ensure no Onyx updates occur.
🟢 Consider adding a connect() test that ensures:
- it returns undefined when not applicable (no delegators and not from OldDot)
- it resolves and applies optimistic updates when called with a valid delegatedAccess.delegators or isFromOldDot
|
@allgandalf All tests are passing / looking good, except 🧪 Once this is fixed, please make sure to update the change-role-issue.mov |
Reviewer Checklist
Screenshots/Videos1. Add a copilot ✅add-delegate.mov2. Remove a copilot ✅remove-delegate.mov3. Update role of copilot ✅Screen.Recording.2025-09-09.at.16.24.54.mov4. Login as copilot into another account ✅switch-delegate.mov |
|
hmm, there are quite a few changes required here, I would need till tomorrow morning to fix these, i will post back @ikevin127 |
|
@allgandalf No problem, most of them are just refactoring suggestions, not blockers. The only blocker is this issue which is failing one of the manual testing steps, that should be addressed. |
Co-authored-by: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com>
Co-authored-by: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com>
Trying to fix this now, on first look i cannot seem to figure out what might be wrong, will try to look into it more, any clues / suggestion is appreciated 😄 |
|
@allgandalf Pretty sure the issue is somewhere in the Why tests didn’t catch it:
|
|
@ikevin127 the issue you mentioned is fixed |
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.
Thanks for fixing the issue! 🚀
LGTM ![]()
|
✋ 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/danieldoglas in version: 9.2.16-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.2.16-14 🚀
|
Explanation of Change
Fixed Issues
$ #66493
PROPOSAL:
Tests
Offline tests
QA Steps
Perform the following actions:
Verify that you are able to perform all the above actions successfully
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))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.Screen.Recording.2025-08-22.at.3.47.48.PM.mov
Screen.Recording.2025-08-22.at.3.50.06.PM.mov