Enable ESLint rule / DEV alert() to match with useOnyx canBeMissing option#59191
Conversation
|
|
|
Can we bump Onyx straight to 2.0.96 so my PR gets there as well? |
|
|
canBeMissing optioncanBeMissing option
|
@parasharrajat 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] |
canBeMissing optioncanBeMissing option
|
This PR is waiting for Expensify/react-native-onyx#624 to be merged and available in a new release so we can use it here. Additionally, in order to keep the changes scoped I won't fix the ESLint errors (that are caused by the rule enabled in this very PR) |
|
|
canBeMissing optioncanBeMissing option
PR is ready to review @parasharrajat @iwiznia |
|
I believe the first time every key will always be empty. It needs to be loaded from the backend then this logic will alert it. So we are saying we will migrate all the |
|
We should update the Expensify.tsx file. |
| const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST); | ||
| const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false}); | ||
| const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); | ||
| const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); |
There was a problem hiding this comment.
This key can be missing? Is it when you are logged out?
| const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); | ||
| const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false}); | ||
| const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE, {canBeMissing: true}); | ||
| const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA, {canBeMissing: true}); |
There was a problem hiding this comment.
lastRouteandscreenShareRequestwill alert during every refresh, even if logged inuserMetadatawill alert if logged out
|
✋ 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 staging by https://github.com/iwiznia in version: 9.1.29-0 🚀
|
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.1.29-10 🚀
|
| const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {canBeMissing: false}); | ||
| const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {canBeMissing: true}); | ||
| const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false, canBeMissing: false}); | ||
| const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: false}); |
There was a problem hiding this comment.
Then this key can be missing so we should set this to true.
|
@iwiznia, I think we should spread awareness about this change on Slack and share some rules on when an onyx key should be true or false. I noticed that almost everyone is setting Even I am not sure when we should set this to false. |
This get done? If so, please share link to the post. |
@iwiznia can you please post a helpful message regarding it. |
|
Sorry for the delay. Documented this here https://stackoverflowteams.com/c/expensify/questions/21738/21739#21739 |
|
This PR caused a ton of warnings about missing values being incorrectly reported. More details - #60531 |





Explanation of Change
Fixed Issues
$ #58499
PROPOSAL:
Tests
useOnyx()s of FreeTrial.tsx component to set thecanBeMissingflag.Offline tests
Same as above.
QA Steps
Not possible for QA to test this.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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
Android: Native
Screen.Recording.2025-03-24.at.17.06.34-compressed.mov
Android: mWeb Chrome
I'm having problems with my emulators when opening the Chrome app (they crash instantly), so I couldn't record videos for this platform.
iOS: Native
Screen.Recording.2025-03-24.at.17.38.16-compressed.mov
iOS: mWeb Safari
Screen.Recording.2025-03-24.at.17.39.48-compressed.mov
MacOS: Chrome / Safari
Screen.Recording.2025-03-24.at.17.42.18-compressed.mov
Screen.Recording.2025-03-24.at.17.43.10-compressed.mov
MacOS: Desktop
Screen.Recording.2025-03-24.at.17.46.40-compressed.mov