-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: get rid of Onyx console errors on login screen #61047
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
fix: get rid of Onyx console errors on login screen #61047
Conversation
@shubham1206agra 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] |
@martasudol Resolve conflicts please |
@@ -226,7 +226,7 @@ function SearchStatusBar({queryJSON, onStatusChange, headerButtonsOptions}: Sear | |||
const isScrolledRef = useRef(false); | |||
const {shouldShowStatusBarLoading} = useSearchContext(); | |||
const {hash} = queryJSON; | |||
const [currentSearchResults] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, {canBeMissing: false}); | |||
const [currentSearchResults] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, {canBeMissing: true}); |
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.
Can you add this in other part of search pages?
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.
It's already added for this onyx key 🤞
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.
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.
Could you please record the flow? I might be following different steps, so I’m not able to reproduce it.
Reviewer Checklist
Screenshots/VideosScreen.Recording.2025-05-07.at.7.31.56.PM.mp4 |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #60531 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
src/components/AttachmentModal.tsx
Outdated
@@ -211,7 +211,7 @@ function AttachmentModal({ | |||
const parentReportAction = getReportAction(report?.parentReportID, report?.parentReportActionID); | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | |||
const transactionID = (isMoneyRequestAction(parentReportAction) && getOriginalMessage(parentReportAction)?.IOUTransactionID) || CONST.DEFAULT_NUMBER_ID; | |||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: false}); | |||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true}); |
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 can this be missing? Isn't this the attachment modal for a transaction? If so, then transaction should exist, no?
@@ -53,7 +53,7 @@ function NavigationTabBar({selectedTab, isTooltipAllowed = false, isTopLevelBar | |||
const {translate} = useLocalize(); | |||
const {activeWorkspaceID} = useActiveWorkspace(); | |||
const {orderedReportIDs} = useSidebarOrderedReportIDs(); | |||
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: false}); | |||
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); |
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.
Don't we load this in OpenApp? How can this be missing? Oh, is it because this component is used when user is not logged in?
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true}); | ||
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false}); | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, {canBeMissing: false}); | ||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, {canBeMissing: true}); |
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.
Same in these, if we are rendering a money preview, we should have the iouReportID and chatReportID loaded, no?
@@ -150,7 +150,7 @@ function ReportPreview({ | |||
shouldDisplayContextMenu = true, | |||
}: ReportPreviewProps) { | |||
const policy = usePolicy(policyID); | |||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: false}); | |||
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true}); |
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.
What is the case of an IOU report that has no chat?
src/components/ReportWelcomeText.tsx
Outdated
@@ -48,9 +48,9 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { | |||
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false}); | |||
const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(report); | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | |||
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || undefined}`, {canBeMissing: false}); | |||
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || undefined}`, {canBeMissing: true}); |
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.
Are we sure this can be missing? I see some things that might not work or behave wrong if reportNameValuePairs is empty, for example we would consider it archived in line 54
src/pages/ReportParticipantsPage.tsx
Outdated
@@ -71,7 +71,7 @@ function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) { | |||
const selectionListRef = useRef<SelectionListHandle>(null); | |||
const textInputRef = useRef<TextInput>(null); | |||
const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE, {canBeMissing: true}); | |||
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: false}); | |||
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`, {canBeMissing: true}); |
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 can we be in the report participants page but not have loaded the report name value pairs?
@@ -138,16 +138,16 @@ function BaseReportActionContextMenu({ | |||
const {isOffline} = useNetwork(); | |||
const {isProduction} = useEnvironment(); | |||
const threedotRef = useRef<View>(null); | |||
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: false}); | |||
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true}); |
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 thought we loaded the betas on OpenApp, so they should always be there... Is this component used when user is not logged in? I assume now since it is a report context menu?
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.
Same for ONYXKEYS.ACCOUNT
below
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.
Yep, this component is used when user is not logged in - it's used in PopoverReportActionContextMenu
and this one is called in Expensify.tsx
.
const [originalReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${originalReportID}`, {canBeMissing: false}); | ||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true}); | ||
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); | ||
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true}); |
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 would we render this component without the report being loaded?
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.
Take a look on the comment above - this component is loaded when user is not logged in yet.
@@ -48,7 +48,7 @@ function ReportActionItem({action, report, ...props}: PureReportActionItemProps) | |||
}); | |||
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getIOUReportIDFromReportActionPreview(action)}`, {canBeMissing: true}); | |||
const [emojiReactions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`, {canBeMissing: true}); | |||
const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: false}); | |||
const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: true}); |
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.
AFAIK we load this on OpenApp and this component is not used when user is not logged in, so why could it be missing?
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false}); | ||
const [isLoading = false] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true}); | ||
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true}); | ||
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); |
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.
Is this page used when user is not logged in?
Asking because this should be set, same as the active policy ID and account below
✋ 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.45-0 🚀
|
🚀 Deployed to staging by https://github.com/iwiznia in version: 9.1.45-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.45-21 🚀
|
Explanation of Change
This PR gets rid of Onyx console error when opening the login screen.
Fixed Issues
$#60531
Tests
Offline tests
Same as Tests.
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
and notonIconClick
)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
N/AAndroid: mWeb Chrome
N/AiOS: Native
N/AiOS: mWeb Safari
N/AMacOS: Chrome / Safari
MacOS: Desktop
N/A