-
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
[CP Staging] Fix crash for unknown action type when getting quick action title #39149
[CP Staging] Fix crash for unknown action type when getting quick action title #39149
Conversation
@@ -154,6 +154,11 @@ function FloatingActionButtonAndPopover(props) { | |||
return []; | |||
}, [props.personalDetails, props.session.accountID, quickActionReport]); | |||
|
|||
const quickActionTitle = useMemo(() => { | |||
const titleKey = getQuickActionTitle(props.quickAction.action); | |||
return titleKey ? translate(titleKey) : ''; |
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.
Now the title will be empty for unknown actions so should we return something instead of ''
.
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.
Actually the crash only occurs in dev enviornment
App/src/libs/Localize/index.ts
Lines 161 to 169 in f5cf3fb
if (Config.IS_IN_PRODUCTION || Config.IS_IN_STAGING) { | |
const phraseString: string = Array.isArray(phraseKey) ? phraseKey.join('.') : phraseKey; | |
Log.alert(`${phraseString} was not found in the en locale`); | |
if (userEmail.includes(CONST.EMAIL.EXPENSIFY_EMAIL_DOMAIN)) { | |
return CONST.MISSING_TRANSLATION; | |
} | |
return phraseString; | |
} | |
throw new Error(`${phraseKey} was not found in the default language`); |
so i beleive we should not suppress it as this may result in unnoticed missing title, which otherwise will be caught if theres a crash
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.
We are not suppressing localization errors but correcting the logic for title so that only when there is a title we translate it. I also added new keys for action.
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.
actually what i meant is if app is crashed when title key is not found in translation that should be the ideal behviour in dev enviornment (opinion), that will help us quickly spot the error in dev enviornment for future newly added actions, otherwise this can be missed.
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.
lets leave it like this, my comment ^ is optional btw
src/languages/es.ts
Outdated
trackManual: 'Track Manual', | ||
trackScan: 'Track Scan', | ||
trackDistance: 'Track Distance', |
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.
@Gonals can you please confirm the new actions and their translations?
@ 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] |
@Gonals What do you think should be done? |
Reviewer Checklist
Screenshots/VideosAndroid: NativeRecord_2024-03-30-00-02-47.mp4Android: mWeb ChromeRecord_2024-03-29-23-56-29.mp4iOS: NativeScreen.Recording.2024-03-30.at.12.04.40.AM.moviOS: mWeb SafariScreen.Recording.2024-03-29.at.11.47.13.PM.movMacOS: Chrome / SafariScreen.Recording.2024-03-29.at.6.47.58.PM.movMacOS: DesktopScreen.Recording.2024-03-30.at.12.08.44.AM-1.mov |
We need translations and I will attach the screenshots. I am even not sure if these texts are correct for shortcut.
|
can we bring this to slack for faster resolution |
PR is ready for review. I confirmed the titles via design doc and added translations. |
HII @parasharrajat what about the icon for track expense shortcut should we also update it? |
This is out of scope of this PR. There are follow-up PRs which will handle more cases. Main purpose of this PR was to fix the crash. I just added more actions so that title is shown on the shortcut. These shortcuts are yet to be implemented. |
okay i'll complete videos |
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.
Looks good! :)
🎯 @ishpaul777, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #39281. |
Lets also add that the clicking on track Expense shortcut will do nothing, in the QA steps |
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.
Awesome, thanks for this PR!
@thienlnam looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
Tests were passing |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…ncrash [CP Staging] Fix crash for unknown action type when getting quick action title (cherry picked from commit 905e689)
🚀 Cherry-picked to staging by https://github.com/yuwenmemon in version: 1.4.58-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.58-8 🚀
|
Regarding PR author checklist item:
Coming from this Slack 🧵 in which the OP reported: Warning Encountered two children with the same key From taking a quick look at the code, looks like this is coming from the fact that we use the Steps:
Note The same happens for the other possible actions:
|
cc: @Gonals @thienlnam
Details
App crashes due to
''
being passed to translate function while determining the quick action title.Fixed Issues
Slack =$ https://expensify.slack.com/archives/C049HHMV9SM/p1711579838530089
PROPOSAL:
Tests
Offline tests
QA Steps
Note: Clicking on Track Expense Shortcut does nothing for now.
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)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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-03-29.at.3.44.22.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-03-29.at.3.45.44.PM.mov
iOS: Native
Screen.Recording.2024-03-29.at.3.48.02.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-03-29.at.3.43.26.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-29.at.3.22.09.PM.mov
MacOS: Desktop
Screen.Recording.2024-03-29.at.3.24.35.PM.mov