-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Replace global variables #47076
Replace global variables #47076
Conversation
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.
Couple minor comments, other than that - great refactor 😄
@@ -355,7 +355,10 @@ const ROUTES = { | |||
}, | |||
ROOM_INVITE: { | |||
route: 'r/:reportID/invite/:role?', | |||
getRoute: (reportID: string, role?: string) => `r/${reportID}/invite/${role}` as const, | |||
getRoute: (reportID: string, role?: string) => { | |||
const route = role ? (`r/${reportID}/invite/${role}` as const) : (`r/${reportID}/invite` as const); |
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.
How about a shorter version?
const route = role ? (`r/${reportID}/invite/${role}` as const) : (`r/${reportID}/invite` as const); | |
getRoute: (reportID: string, role?: string) => `r/${reportID}/invite${role ? `/${role}`: ''}` as const, |
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.
@BrtqKr Could you please help to detail which problem here?
Fixed role undefined case on room members invite
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.
when someone didn't have a role inside of a report we ended up with /undefined
inside of the url. It just seems like someone forgot to put a proper fallback in there
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.
@BrtqKr With previous code, we added a fallback value is empty string. Why shouldn't use ?? operator?
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.
Not sure what you meant exactly, but two explanations:
1.
getRoute: (reportID: string, role?: string) =>
r/${reportID}/invite/${role} as const,
In the previous version, skipping the role meant getting undefined, which was getting stringified, which resulted in for example
r/151422415264937/invite/undefined
in the url.
??
operator works only as a fallback for null and undefined and in this case we want to include empty string in the same group to remove slash for this scenario
@@ -174,8 +173,6 @@ const modalScreenListeners = { | |||
Modal.setModalVisibility(false); | |||
}, | |||
beforeRemove: () => { | |||
// Clear search input (WorkspaceInvitePage) when modal is closed | |||
SearchInputManager.searchInput = ''; |
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.
Shouldn't we clear it here?
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.
No, because we've removed the usage of persist on that page. Apparently navigation patterns have changed and this is no longer necessary.
Onyx.merge(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, value); | ||
} | ||
|
||
export {clearUserSearchPhrase as clearUserSearchValue, updateUserSearchPhrase}; |
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.
export {clearUserSearchPhrase as clearUserSearchValue, updateUserSearchPhrase}; | |
export {clearUserSearchPhrase, updateUserSearchPhrase}; |
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.
leftover, sorry
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
function clearUserSearchPhrase() { | ||
Onyx.set(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, ''); |
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.
Let's use merge here as well
@DylanDylann 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] |
@BrtqKr Minor question #47076 (comment) and please resolve conflict |
@BrtqKr Friendly bump |
@DylanDylann Bartek got sick 😢 He will get back to it later this week or in the upcoming week |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-28.at.17.52.50.movAndroid: mWeb ChromeScreen.Recording.2024-08-28.at.17.53.29.moviOS: NativeScreen.Recording.2024-08-28.at.17.51.47.moviOS: mWeb SafariScreen.Recording.2024-08-28.at.17.52.24.movMacOS: Chrome / SafariScreen.Recording.2024-08-28.at.17.42.50.movMacOS: DesktopScreen.Recording.2024-08-28.at.17.50.29.mov |
@grgia All yours |
@BrtqKr Conflict |
@grgia, I think this should be done 🙏 |
@BrtqKr we can merge once conflicts are fixed! Thanks for your patience, I was OOO |
Ok, I needed to adjust RoomParticipants after changes from the main, but it seems to be working as expected |
bump for rereview after changes @DylanDylann |
The new change in @grgia All yours |
✋ 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 production by https://github.com/luacmartins in version: 9.0.33-4 🚀
|
role
undefined case on room members inviteDetails
Fixed Issues
$ #47783
PROPOSAL: https://swmansion.slack.com/archives/C05LX9D6E07/p1723130121950609
Tests
Everything is related to the RHP screens, that contain user search - the behaviour should be identical to the current state of the app, that is:
The changes have been applied to both room members and room participants flows.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop