Fix: Web - Error message "Uh-oh, something went wrong!" when trying to access a workspace member's URL while logged into a different account#24457
Conversation
|
@rushatgabhane 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] |
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
| const validateSelection = useCallback(() => { | ||
| const newErrors = {}; | ||
| const ownerAccountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([props.policy.owner])); | ||
| const ownerAccountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([props.policy.owner || ''])); |
There was a problem hiding this comment.
@Pujan92 i feel that we should fix the issue inside getAccountIDsByLogins() to handle undefined values. So any other call to this function won't have this issue again with undefined values. What do you think?
There was a problem hiding this comment.
I am not very sure but agreed on To avoid this issue at other places, definitely we can handle it within getAccountIDsByLogins.
There was a problem hiding this comment.
sorry, i don't understand. Could you please help me understand why we aren't handling undefined values in getAccountIDsByLogins()
There was a problem hiding this comment.
I made the commit to handle it within getAccountIDsByLogins, initially I thought better to pass an empty string from a parent but later it seems a good and safer idea is to handle it within getAccountIDsByLogins which you have suggested.
There was a problem hiding this comment.
can't we return early instead of pushing empty values? that'll bring us back to undefined value i guess 😅
There was a problem hiding this comment.
Ohh, you mean to say why to generate new accountID of the policy owner as the policy itself is not available for the user.
App/src/libs/PersonalDetailsUtils.js
Line 68 in 0bdf183
if (!_.isUndefined(login)) {Generate and push new id in
foundAccountIDs only when the login is not undefined, does it makes sense?
There was a problem hiding this comment.
@rushatgabhane don't you think we should restrict passing undefined from the parent only and why to add check in the getAccountIDsByLogins ?
I prefer here to update like
const ownerAccountID = props.policy.owner ?_.first(PersonalDetailsUtils.getAccountIDsByLogins([props.policy.owner])) : undefined;
|
bump @rushatgabhane |
Details
#23814
Fixed Issues
$ #23814
PROPOSAL: #23814 (comment)
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.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)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Screen.Recording.2023-08-11.at.10.02.33.PM.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android