-
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
Changes from all commits
5a175d9
0d3cc6e
75654cf
f06810d
d6df1ba
30ff249
a311867
ba8b960
07a3dce
aff91e1
86db79c
902e65c
043056c
dd11582
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ import * as SessionUtils from '@libs/SessionUtils'; | |
import ConnectionCompletePage from '@pages/ConnectionCompletePage'; | ||
import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; | ||
import DesktopSignInRedirectPage from '@pages/signin/DesktopSignInRedirectPage'; | ||
import SearchInputManager from '@pages/workspace/SearchInputManager'; | ||
import * as App from '@userActions/App'; | ||
import * as Download from '@userActions/Download'; | ||
import * as Modal from '@userActions/Modal'; | ||
|
@@ -198,8 +197,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 commentThe 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 commentThe 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. |
||
Modal.setModalVisibility(false); | ||
Modal.willAlertModalBecomeVisible(false); | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Onyx from 'react-native-onyx'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
function clearUserSearchPhrase() { | ||
Onyx.merge(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, ''); | ||
} | ||
|
||
/** | ||
* Persists user search phrase from the serch input across the screens. | ||
*/ | ||
function updateUserSearchPhrase(value: string) { | ||
Onyx.merge(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, value); | ||
} | ||
|
||
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.
How about a shorter version?
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?
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 thereThere 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