diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 033342db30b99..622ccff5d27da 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -86,7 +86,6 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c - [ ] iOS: mWeb Safari - [ ] MacOS: Chrome / Safari - [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed) -- [ ] I verified there are no new alerts related to the `canBeMissing` param for `useOnyx` - [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code)) - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`) - [ ] I verified that comments were added to code that is not self explanatory diff --git a/contributingGuides/REVIEWER_CHECKLIST.md b/contributingGuides/REVIEWER_CHECKLIST.md index 08d033144f1c3..d200111e495b4 100644 --- a/contributingGuides/REVIEWER_CHECKLIST.md +++ b/contributingGuides/REVIEWER_CHECKLIST.md @@ -17,7 +17,6 @@ - [ ] iOS: mWeb Safari - [ ] MacOS: Chrome / Safari - [ ] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack -- [ ] I verified there are no new alerts related to the `canBeMissing` param for `useOnyx` - [ ] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code)) - [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`). - [ ] I verified that comments were added to code that is not self explanatory diff --git a/contributingGuides/philosophies/ONYX-DATA-MANAGEMENT.md b/contributingGuides/philosophies/ONYX-DATA-MANAGEMENT.md index e0bf8b5c48f4a..24131557c5915 100644 --- a/contributingGuides/philosophies/ONYX-DATA-MANAGEMENT.md +++ b/contributingGuides/philosophies/ONYX-DATA-MANAGEMENT.md @@ -9,7 +9,6 @@ This is how the application manages all the data stored in Onyx. - **Actions** - The files stored in `/src/libs/actions` - **Derived Values** - Special Onyx keys containing values computed from other Onyx values - **Collections** - Multiple related data objects stored as individual keys with IDs -- **canBeMissing** - Parameter indicating whether a component expects Onyx data to be present ## Rules ### - Actions MUST be the only means to write or read data from the server @@ -126,24 +125,3 @@ compute: ([reports, personalDetails]) => { - Explain the purpose and dependencies - Document any special cases or performance considerations - Include type annotations for better developer experience - -## canBeMissing Parameter - -The `canBeMissing` parameter indicates whether a component connecting to Onyx expects the data to be present or if it can handle missing data gracefully. - -### - Components MUST use the `canBeMissing` parameter appropriately -This parameter was added because in some places we are assuming some data will be there, but actually we never load it, which leads to hard to debug bugs. - -The linter error exists until we add the param to all callers. Once that happens we can make the param mandatory and remove the linter. - -### - `canBeMissing` SHOULD be set to `false` when data is guaranteed to be present -The main criteria for setting `canBeMissing` to `false`: - -- **Data is always loaded before component renders**: If the data is always ensured to be loaded before this component renders, then `canBeMissing` SHOULD be set to `false` -- **Always returned by OpenApp**: Any data that is always returned by `OpenApp` used in a component where we have a user (so not in the homepage for example) will have `canBeMissing` set to `false` -- **User always has data**: Maybe we always try to load a piece of data, but the data can be missing/empty, in this case `canBeMissing` would be set to `false` - -### - `canBeMissing` SHOULD be set to `true` for potentially missing data -If neither of the above conditions apply, then the param SHOULD probably be `true`, but additionally we MUST make sure that the code using the data manages correctly the fact that the data might be missing. - -Context: [Slack discussion](https://expensify.slack.com/archives/C03TQ48KC/p1741208342513379) diff --git a/eslint.changed.config.mjs b/eslint.changed.config.mjs index 070731296949c..79114b59a65eb 100644 --- a/eslint.changed.config.mjs +++ b/eslint.changed.config.mjs @@ -43,7 +43,6 @@ const config = defineConfig([ rules: { '@typescript-eslint/no-deprecated': 'error', 'rulesdir/no-default-id-values': 'error', - 'rulesdir/provide-canBeMissing-in-useOnyx': 'error', 'rulesdir/no-unstable-hook-defaults': 'error', 'no-restricted-syntax': [ 'error', diff --git a/package-lock.json b/package-lock.json index dfdf6fd288363..e38bb6d953dd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -117,7 +117,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.29.4", "react-native-nitro-sqlite": "9.2.0", - "react-native-onyx": "3.0.35", + "react-native-onyx": "3.0.38", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-performance": "^6.0.0", @@ -34210,9 +34210,9 @@ } }, "node_modules/react-native-onyx": { - "version": "3.0.35", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.35.tgz", - "integrity": "sha512-YlDoiN7IGi/Mj0UUwv/cPz33IOITNeQFohlNL8RdEppC88aA/Xv4vmoTs9AC71AleDx0OPOoDW/lm5jbxkzphQ==", + "version": "3.0.38", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.38.tgz", + "integrity": "sha512-hy1DqpBUtsHMgr6EUGA8Qbg2m4mq8Ki+dlAM9uj8z/wi5SA4wJCucxezYNg1fuknh0adaydRzP7QEA42awi38w==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index 73067434d8274..6dbcfee8c1222 100644 --- a/package.json +++ b/package.json @@ -180,7 +180,7 @@ "react-native-localize": "^3.5.4", "react-native-nitro-modules": "0.29.4", "react-native-nitro-sqlite": "9.2.0", - "react-native-onyx": "3.0.35", + "react-native-onyx": "3.0.38", "react-native-pager-view": "8.0.0", "react-native-pdf": "7.0.2", "react-native-performance": "^6.0.0", diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 5847395a6fab5..bbacb2e209dd0 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -33,9 +33,8 @@ import {hasAuthToken} from './libs/actions/Session'; import * as User from './libs/actions/User'; import * as ActiveClientManager from './libs/ActiveClientManager'; import {isSafari} from './libs/Browser'; -import * as Environment from './libs/Environment/Environment'; import FS from './libs/Fullstory'; -import Growl, {growlRef} from './libs/Growl'; +import {growlRef} from './libs/Growl'; import Log from './libs/Log'; import migrateOnyx from './libs/migrateOnyx'; import Navigation from './libs/Navigation/Navigation'; @@ -62,13 +61,6 @@ Onyx.registerLogger(({level, message, parameters}) => { if (level === 'alert') { Log.alert(message, parameters); console.error(message); - - // useOnyx() calls with "canBeMissing" config set to false will display a visual alert in dev environment - // when they don't return data. - const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters && 'key' in parameters; - if (Environment.isDevelopment() && shouldShowAlert) { - Growl.error(`${message} Key: ${parameters.key as string}`, 10000); - } } else if (level === 'hmmm') { Log.hmmm(message, parameters); } else { @@ -106,24 +98,24 @@ function Expensify() { const {setSplashScreenState} = useSplashScreenActions(); const [hasAttemptedToOpenPublicRoom, setAttemptedToOpenPublicRoom] = useState(false); const {translate, preferredLocale} = useLocalize(); - const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); - const [session, sessionMetadata] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); - const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE, {canBeMissing: true}); - const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA, {canBeMissing: true}); - const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false, canBeMissing: true}); - const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false, canBeMissing: true}); - const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false, canBeMissing: true}); - const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {canBeMissing: true}); - const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {canBeMissing: true}); - const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true}); - const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false}); - const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP, {canBeMissing: true}); - const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true}); + const [account] = useOnyx(ONYXKEYS.ACCOUNT); + const [session, sessionMetadata] = useOnyx(ONYXKEYS.SESSION); + const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE); + const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA); + const [isCheckingPublicRoom = true] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false}); + const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false}); + const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false}); + const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED); + const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST); + const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); + const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); + const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP); + const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP); const {isOffline} = useNetwork(); - const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {canBeMissing: true}); - const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {canBeMissing: true}); - const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true}); - const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID, {canBeMissing: true}); + const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS); + const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION); + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); useDebugShortcut(); usePriorityMode(); diff --git a/src/HybridAppHandler.tsx b/src/HybridAppHandler.tsx index fbf52568bb9c9..2b0b424962e2e 100644 --- a/src/HybridAppHandler.tsx +++ b/src/HybridAppHandler.tsx @@ -14,7 +14,7 @@ import isLoadingOnyxValue from './types/utils/isLoadingOnyxValue'; function HybridAppHandler() { const {splashScreenState} = useSplashScreenState(); const {setSplashScreenState} = useSplashScreenActions(); - const [tryNewDot, tryNewDotMetadata] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true}); + const [tryNewDot, tryNewDotMetadata] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT); const isLoadingTryNewDot = isLoadingOnyxValue(tryNewDotMetadata); const finalizeTransitionFromOldDot = useCallback( diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index fea10add66b7f..c6989851c0c7a 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -47,14 +47,14 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { const {localeCompare, translate, formatPhoneNumber} = useLocalize(); const {isOffline} = useNetwork(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); - const [accountID] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: accountIDSelector}); - const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED, {canBeMissing: true}); - const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS, {canBeMissing: true}); - const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS, {canBeMissing: true}); - const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); - const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION, {canBeMissing: true}); - const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true}); + const [account] = useOnyx(ONYXKEYS.ACCOUNT); + const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector}); + const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED); + const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS); + const [stashedCredentials = CONST.EMPTY_OBJECT] = useOnyx(ONYXKEYS.STASHED_CREDENTIALS); + const [session] = useOnyx(ONYXKEYS.SESSION); + const [stashedSession] = useOnyx(ONYXKEYS.STASHED_SESSION); + const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const buttonRef = useRef(null); const {windowHeight} = useWindowDimensions(); diff --git a/src/components/AddPaymentCard/PaymentCardForm.tsx b/src/components/AddPaymentCard/PaymentCardForm.tsx index 12491ac1afea1..78af529f747c4 100644 --- a/src/components/AddPaymentCard/PaymentCardForm.tsx +++ b/src/components/AddPaymentCard/PaymentCardForm.tsx @@ -126,7 +126,7 @@ function PaymentCardForm({ currencySelectorRoute, }: PaymentCardFormProps) { const styles = useThemeStyles(); - const [data, metadata] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM, {canBeMissing: true}); + const [data, metadata] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM); const {translate} = useLocalize(); const route = useRoute(); diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 26801e3a0a464..c4b60bd1eaf55 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -60,8 +60,8 @@ function AddPaymentMethodMenu({ const icons = useMemoizedLazyExpensifyIcons(['Building', 'Bank']); const {translate} = useLocalize(); const [restoreFocusType, setRestoreFocusType] = useState(); - const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); - const [introSelected, introSelectedStatus] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true}); + const [session] = useOnyx(ONYXKEYS.SESSION); + const [introSelected, introSelectedStatus] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); // Users can choose to pay with business bank account in case of Expense reports or in case of P2P IOU report // which then starts a bottom up flow and creates a Collect workspace where the payer is an admin and payee is an employee. diff --git a/src/components/AddPlaidBankAccount.tsx b/src/components/AddPlaidBankAccount.tsx index 1a53f0a9d1e9e..dd9634274207e 100644 --- a/src/components/AddPlaidBankAccount.tsx +++ b/src/components/AddPlaidBankAccount.tsx @@ -82,8 +82,8 @@ function AddPlaidBankAccount({ const subscribedKeyboardShortcuts = useRef void>>([]); const previousNetworkState = useRef(undefined); const [selectedPlaidAccountMask, setSelectedPlaidAccountMask] = useState(defaultSelectedPlaidAccountMask); - const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {canBeMissing: true, initWithStoredValues: false}); - const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED, {canBeMissing: true}); + const [plaidLinkToken] = useOnyx(ONYXKEYS.PLAID_LINK_TOKEN, {initWithStoredValues: false}); + const [isPlaidDisabled] = useOnyx(ONYXKEYS.IS_PLAID_DISABLED); const {translate} = useLocalize(); const {isOffline} = useNetwork(); diff --git a/src/components/AddUnreportedExpenseFooter.tsx b/src/components/AddUnreportedExpenseFooter.tsx index 9042b0b022b41..52fb0ceb7f0e2 100644 --- a/src/components/AddUnreportedExpenseFooter.tsx +++ b/src/components/AddUnreportedExpenseFooter.tsx @@ -42,12 +42,12 @@ function AddUnreportedExpenseFooter({selectedIds, report, reportToConfirm, repor const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); const session = useSession(); const personalDetails = usePersonalDetails(); - const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: true}); - const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true}); - const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {canBeMissing: true}); - const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true}); - const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true}); - const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`, {canBeMissing: true}); + const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); + const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); + const [policyRecentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES); + const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE); + const [betas] = useOnyx(ONYXKEYS.BETAS); + const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`); const handleConfirm = () => { if (selectedIds.size === 0) { diff --git a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx index 03159e30cf5c8..a36f6fb862b61 100644 --- a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx +++ b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx @@ -28,7 +28,7 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP const sourceURLWithAuth = addEncryptedAuthTokenToURL(source); const sourceID = (source.match(CONST.REGEX.ATTACHMENT_ID) ?? [])[1]; - const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`, {canBeMissing: true}); + const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`); const {translate} = useLocalize(); const {isOffline} = useNetwork(); diff --git a/src/components/ApprovalWorkflowSection.tsx b/src/components/ApprovalWorkflowSection.tsx index e5849c7eaf009..44dc9b1a1d02a 100644 --- a/src/components/ApprovalWorkflowSection.tsx +++ b/src/components/ApprovalWorkflowSection.tsx @@ -36,7 +36,6 @@ function ApprovalWorkflowSection({approvalWorkflow, onPress, currency = CONST.CU const {translate, toLocaleOrdinal, localeCompare} = useLocalize(); const {shouldUseNarrowLayout} = useResponsiveLayout(); const [personalDetailsByEmail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, { - canBeMissing: true, selector: personalDetailsByEmailSelector, }); diff --git a/src/components/ApproverSelectionList.tsx b/src/components/ApproverSelectionList.tsx index 897efe88be60d..837d9ce43edb0 100644 --- a/src/components/ApproverSelectionList.tsx +++ b/src/components/ApproverSelectionList.tsx @@ -71,7 +71,7 @@ function ApproverSelectionList({ const styles = useThemeStyles(); const {translate, localeCompare} = useLocalize(); const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); - const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE, {canBeMissing: false}); + const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE); const shouldShowTextInput = shouldShowTextInputProp ?? allApprovers?.length >= CONST.STANDARD_LIST_ITEM_LIMIT; const lazyIllustrations = useMemoizedLazyIllustrations(['TurtleInShell']); diff --git a/src/components/ArchivedReportFooter.tsx b/src/components/ArchivedReportFooter.tsx index ff472f3308416..66abbf25d0410 100644 --- a/src/components/ArchivedReportFooter.tsx +++ b/src/components/ArchivedReportFooter.tsx @@ -24,8 +24,8 @@ function ArchivedReportFooter({report, currentUserAccountID}: ArchivedReportFoot const styles = useThemeStyles(); const {translate} = useLocalize(); - const [personalDetails = getEmptyObject()] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false}); - const [reportClosedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {canEvict: false, selector: getLastClosedReportAction, canBeMissing: true}); + const [personalDetails = getEmptyObject()] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); + const [reportClosedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {canEvict: false, selector: getLastClosedReportAction}); const originalMessage = isClosedAction(reportClosedAction) ? getOriginalMessage(reportClosedAction) : null; const archiveReason = originalMessage?.reason ?? CONST.REPORT.ARCHIVE_REASON.DEFAULT; const actorPersonalDetails = personalDetails?.[reportClosedAction?.actorAccountID ?? CONST.DEFAULT_NUMBER_ID]; diff --git a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx index 161dd5d8a488d..80ca17dac5290 100644 --- a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx +++ b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx @@ -38,7 +38,7 @@ function CarouselItem({item, onPress, isFocused, isModalHovered, reportID}: Caro const {translate} = useLocalize(); const {isAttachmentHidden} = useContext(AttachmentModalContext); const [isHidden, setIsHidden] = useState(() => (item.reportActionID && isAttachmentHidden(item.reportActionID)) ?? item.hasBeenFlagged); - const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true}); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`); const renderButton = (style: StyleProp) => (