-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Reports with "report not found" error cause Inbox tab RBR #51675
Changes from all commits
81b6b6e
6c5b958
f56b1f3
32e0ffa
7a069b3
acba675
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React, {useCallback, useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import Button from '@components/Button'; | ||
import Icon from '@components/Icon'; | ||
|
@@ -21,12 +21,18 @@ import ONYXKEYS from '@src/ONYXKEYS'; | |
import type {Route} from '@src/ROUTES'; | ||
import ROUTES from '@src/ROUTES'; | ||
import SCREENS from '@src/SCREENS'; | ||
import type {ReimbursementAccount} from '@src/types/onyx'; | ||
import type {Beta, Policy, PriorityMode, ReimbursementAccount, Report, TransactionViolations} from '@src/types/onyx'; | ||
|
||
type DebugTabViewProps = { | ||
selectedTab?: string; | ||
chatTabBrickRoad: BrickRoad; | ||
activeWorkspaceID?: string; | ||
currentReportID: string | null; | ||
reports: OnyxCollection<Report>; | ||
betas: OnyxEntry<Beta[]>; | ||
policies: OnyxCollection<Policy>; | ||
transactionViolations: OnyxCollection<TransactionViolations>; | ||
priorityMode: OnyxEntry<PriorityMode>; | ||
}; | ||
|
||
function getSettingsMessage(status: IndicatorStatus | undefined): TranslationPaths | undefined { | ||
|
@@ -91,7 +97,7 @@ function getSettingsRoute(status: IndicatorStatus | undefined, reimbursementAcco | |
} | ||
} | ||
|
||
function DebugTabView({selectedTab = '', chatTabBrickRoad, activeWorkspaceID}: DebugTabViewProps) { | ||
function DebugTabView({selectedTab = '', chatTabBrickRoad, activeWorkspaceID, currentReportID, reports, betas, policies, transactionViolations, priorityMode}: DebugTabViewProps) { | ||
const StyleUtils = useStyleUtils(); | ||
const theme = useTheme(); | ||
const styles = useThemeStyles(); | ||
|
@@ -131,7 +137,7 @@ function DebugTabView({selectedTab = '', chatTabBrickRoad, activeWorkspaceID}: D | |
|
||
const navigateTo = useCallback(() => { | ||
if (selectedTab === SCREENS.HOME && !!chatTabBrickRoad) { | ||
const report = getChatTabBrickRoadReport(activeWorkspaceID); | ||
const report = getChatTabBrickRoadReport(activeWorkspaceID, currentReportID, reports, betas, policies, priorityMode, transactionViolations); | ||
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. Could we use chatTabBrickRoad directly instead of getChatTabBrickRoadReport function? 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.
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. 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. @DylanDylann nope, it returns a |
||
|
||
if (report) { | ||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)); | ||
|
@@ -144,7 +150,7 @@ function DebugTabView({selectedTab = '', chatTabBrickRoad, activeWorkspaceID}: D | |
Navigation.navigate(route); | ||
} | ||
} | ||
}, [selectedTab, chatTabBrickRoad, activeWorkspaceID, status, reimbursementAccount, policyIDWithErrors]); | ||
}, [selectedTab, chatTabBrickRoad, activeWorkspaceID, currentReportID, reports, betas, policies, priorityMode, transactionViolations, status, reimbursementAccount, policyIDWithErrors]); | ||
|
||
if (!([SCREENS.HOME, SCREENS.SETTINGS.ROOT] as string[]).includes(selectedTab) || !indicator) { | ||
return 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.
Hmm, why is this comment just about reportActions. All of these are needed since any of them can affect the RBR, right?
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.
@puneetlath I left the comment specific for reportActions because they are not being used inside the effect explicitly. So to prevent someone from removing the prop from the dependencies list I added that comment 😄
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.
Ah ok I see. That makes sense.