-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[TS migration] Migrate 'Expensify.js' file to TypeScript #35296
Conversation
src/Expensify.tsx
Outdated
isCheckingPublicRoom: OnyxEntry<boolean>; | ||
session: OnyxEntry<Session>; | ||
updateAvailable: OnyxEntry<boolean>; | ||
isSidebarLoaded: OnyxEntry<boolean>; | ||
screenShareRequest: OnyxEntry<ScreenShareRequest>; | ||
focusModeNotification: OnyxEntry<boolean>; |
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.
Please keep the previous comments
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.
I updated.
src/Expensify.tsx
Outdated
session = { | ||
authToken: undefined, | ||
accountID: undefined, | ||
}, |
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.
session = { | |
authToken: undefined, | |
accountID: undefined, | |
}, |
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.
Why do we remove it?
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.
If session
can be null
because it's an Onyx value and we are just setting authToken
and accountID
to undefined
here, it looks to me that this default object is useless. Could you try to remove it and test if it works correctly?
src/Expensify.tsx
Outdated
}, | ||
updateAvailable = false, | ||
isSidebarLoaded = false, | ||
screenShareRequest = null, |
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.
screenShareRequest = null, |
src/Expensify.tsx
Outdated
@@ -157,8 +130,14 @@ function Expensify(props) { | |||
Log.info('[BootSplash] splash screen status', false, {appState, status}); | |||
|
|||
if (status === 'visible') { | |||
const propsToLog = _.omit(props, ['children', 'session']); | |||
propsToLog.isAuthenticated = isAuthenticated; | |||
const propsToLog = { |
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.
const propsToLog = { | |
const propsToLog: Omit<ExpensifyProps, 'children' | 'session'> = { |
import Onyx from 'react-native-onyx'; | ||
import subscribeToReportCommentPushNotifications from '@libs/Notification/PushNotification/subscribeToReportCommentPushNotifications'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import PushNotification from '..'; | ||
|
||
export default function subscribePushNotification(notificationID: OnyxEntry<string>) { |
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.
@arosiclair Could you take a look at this changes? Expensify.js was importing subscribePushNotification
which actually didn't exist until now in this PR. Should we just remove the import from Expensify.js
and leave this file unchanged?
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.
That was first added in this PR and the module should still exist here. It's only purpose is to subscribe the callback and it's written in a separate module just to avoid require cycles. So we should keep the import and the module since removing it would break push notifications. Though we can probably remove the unnecessary variable from it like so:
import './libs/Notification/PushNotification/subscribePushNotification';
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.
Ohh yes, my VSCode was not taking me to the file, thought it didn't exist 😅 Thanks @arosiclair !
src/Expensify.tsx
Outdated
import * as Growl from './libs/Growl'; | ||
import Log from './libs/Log'; | ||
import migrateOnyx from './libs/migrateOnyx'; | ||
import Navigation from './libs/Navigation/Navigation'; | ||
import NavigationRoot from './libs/Navigation/NavigationRoot'; | ||
import NetworkConnection from './libs/NetworkConnection'; | ||
import PushNotification from './libs/Notification/PushNotification'; | ||
// eslint-disable-next-line no-unused-vars | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import subscribePushNotification from './libs/Notification/PushNotification/subscribePushNotification'; |
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.
import subscribePushNotification from './libs/Notification/PushNotification/subscribePushNotification'; | |
import './libs/Notification/PushNotification/subscribePushNotification'; |
@fabioh8010 I updated. |
Co-authored-by: Fábio Henriques <fabio.lacerda@outlook.com>
Co-authored-by: Fábio Henriques <fabio.lacerda@outlook.com>
@fabioh8010 I updated. |
Reviewer Checklist
Screenshots/VideosAndroid: Native35296.Android.mp4Android: mWeb Chrome35296.mWeb-Chrome.mp4iOS: NativeUploading 35296 iOS.mp4… iOS: mWeb Safari35296.mWeb-Safari.mp4MacOS: Chrome / Safari35296.Web.mp4MacOS: Desktop35296.Desktop.mp4 |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25231 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@lakchote This PR ready for review! |
@dukenv0307 Can you rename the PR so it matches issue title? |
Friendly bump @lakchote and @dukenv0307 for the above comment, thanks! |
@mollfpr @blazejkustra Updated. |
@lakchote Please help to review the PR when you have a chance. |
Typescript check is failing, let's wrap this PR up! 😀 |
@blazejkustra Merged main to fix ts error. |
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.
Fixed now. |
DM'ed @lakchote for a review! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@mollfpr @dukenv0307 it causes a regression in e2e tests I have submitted a revert PR here |
@lakchote I replied here #37586 (comment) |
Thanks, please dismiss my comment. It was a false positive. |
🚀 Deployed to staging by https://github.com/lakchote in version: 1.4.47-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.47-10 🚀
|
import StartupTimer from './libs/StartupTimer'; | ||
// This lib needs to be imported, but it has nothing to export since all it contains is an Onyx connection | ||
// eslint-disable-next-line no-unused-vars | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import UnreadIndicatorUpdater from './libs/UnreadIndicatorUpdater'; |
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.
Unfortunately, this line caused unexpected regression. This was not a problem before migrating to TS.
More details: #38256 (comment)
Details
migrate
Expensify.js
to typescriptFixed Issues
$ #25231
PROPOSAL: None
Tests
Offline tests
None
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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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
Screen.Recording.2024-01-29.at.11.28.33.mov
Android: mWeb Chrome
Screen.Recording.2024-01-29.at.11.25.45.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-01-29.at.11.22.28.mov
MacOS: Chrome / Safari
Screen.Recording.2024-01-29.at.11.21.45.mov
MacOS: Desktop
Screen.Recording.2024-01-29.at.11.32.48.mov