Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
901 changes: 228 additions & 673 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/awaitStagingDeploys/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/bumpVersion/index.js

Large diffs are not rendered by default.

903 changes: 229 additions & 674 deletions .github/actions/javascript/checkAndroidStatus/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/checkDeployBlockers/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/checkSVGCompression/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/failureNotifier/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/formatCodeCovComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/generateHelpPreviewComment/index.js

Large diffs are not rendered by default.

903 changes: 229 additions & 674 deletions .github/actions/javascript/getAndroidRolloutPercentage/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getArtifactInfo/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getDeployPullRequestList/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPreviousVersion/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPullRequestDetails/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPullRequestIncrementalChanges/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/isAuthorizedContributor/index.js

Large diffs are not rendered by default.

1,208 changes: 369 additions & 839 deletions .github/actions/javascript/isDeployChecklistLocked/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/markPullRequestsAsDeployed/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/postOrReplaceComment/index.js

Large diffs are not rendered by default.

1,208 changes: 369 additions & 839 deletions .github/actions/javascript/proposalPoliceComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/reopenIssueWithComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/reviewerChecklist/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/validateReassureOutput/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/verifySignedCommits/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/verifyStagingBuildsSucceeded/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __mocks__/react-native-onyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ConnectOptions, OnyxKey} from 'react-native-onyx';

// eslint-disable-next-line no-restricted-imports
import Onyx, {useOnyx} from 'react-native-onyx';
import Onyx, {useOnyx, useOnyxState} from 'react-native-onyx';

let connectCallbackDelay = 0;
function addDelayToConnectCallback(delay: number) {
Expand Down Expand Up @@ -41,4 +41,4 @@ const reactNativeOnyxMock: ReactNativeOnyxMock = {

export default reactNativeOnyxMock;

export {useOnyx};
export {useOnyx, useOnyxState};
2 changes: 0 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,6 @@ const ONYXKEYS = {
NON_PERSONAL_AND_WORKSPACE_CARD_LIST: 'nonPersonalAndWorkspaceCardList',
PERSONAL_AND_WORKSPACE_CARD_LIST: 'personalAndWorkspaceCardList',
CARD_FEED_ERRORS: 'cardFeedErrors',
RAM_ONLY_SORTED_REPORT_ACTIONS: 'sortedReportActions',
LOGIN_TO_ACCOUNT_ID_MAP: 'loginToAccountIDMap',
GUIDE_ACCOUNT_IDS: 'guideAccountIDs',
SPEND_DATA_SIGNATURE: 'spendDataSignature',
Expand Down Expand Up @@ -2023,7 +2022,6 @@ type OnyxDerivedValuesMapping = {
[ONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LIST]: OnyxTypes.NonPersonalAndWorkspaceCardListDerivedValue;
[ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST]: OnyxTypes.PersonalAndWorkspaceCardListDerivedValue;
[ONYXKEYS.DERIVED.CARD_FEED_ERRORS]: OnyxTypes.CardFeedErrorsDerivedValue;
[ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS]: OnyxTypes.SortedReportActionsDerivedValue;
[ONYXKEYS.DERIVED.LOGIN_TO_ACCOUNT_ID_MAP]: OnyxTypes.LoginToAccountIDMapDerivedValue;
[ONYXKEYS.DERIVED.SPEND_DATA_SIGNATURE]: OnyxTypes.SpendDataSignatureDerivedValue;
[ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS]: OnyxTypes.GuideAccountIDsDerivedValue;
Expand Down
7 changes: 5 additions & 2 deletions src/components/Table/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function TableBodyList({contentContainerStyle, emptyMessage, onLayout, style, ..
noResultsStateElement,
tableListMetadata,
isEmptyResult,
isDefaultViewEmpty,
scrollWidth,
tableWidth,
} = useTableContext<TableData>();
Expand Down Expand Up @@ -337,8 +338,10 @@ function TableBodyList({contentContainerStyle, emptyMessage, onLayout, style, ..
</View>
);

const emptyStateContent =
tableListMetadata.hasPageHeader && isEmptyResult ? (noResultsStateElement ?? EmptyResultComponent) : (emptyStateElement ?? renderListComponent(ListEmptyComponent));
// When the default view hides every row (e.g. all workspaces are archived), no search or filter is active,
// so show the empty state rather than "No results".
const shouldShowNoResultsState = tableListMetadata.hasPageHeader && isEmptyResult && !isDefaultViewEmpty;
const emptyStateContent = shouldShowNoResultsState ? (noResultsStateElement ?? EmptyResultComponent) : (emptyStateElement ?? renderListComponent(ListEmptyComponent));
const footerElement = renderListComponent(ListFooterComponent);
// Consumer footer flex growth is useful below normal rows, but inside the combined empty-state
// footer it can expand over the page header. Preserve the remaining style while disabling growth.
Expand Down
5 changes: 3 additions & 2 deletions src/components/Table/TableEmptyStates/TableNoResultsState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ type TableNoResultsStateProps = Omit<GenericEmptyStateComponentProps, 'headerMed
export default function TableNoResultsState(emptyStateProps: TableNoResultsStateProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {isEmptyResult, tableListMetadata} = useTableContext();
const {isEmptyResult, isDefaultViewEmpty, tableListMetadata} = useTableContext();
const illustrations = useMemoizedLazyIllustrations(['EmptyShelves']);

if (!isEmptyResult) {
// The default view hiding every row is not a search/filter result, so the empty state handles it instead.
if (!isEmptyResult || isDefaultViewEmpty) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useFilteredOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function useFilteredOptions(config: UseFilteredOptionsConfig): UseFilteredOption
const {preferredLocale, dateFnsLocale} = useLocalize();
const {convertToDisplayString} = useCurrencyListActions();

// Sorted report actions from the RAM_ONLY_SORTED_REPORT_ACTIONS derived value; a new reference on
// every recompute, so it doubles as the report-actions invalidation signal for the option-list cache.
// A new reference only when a report's sorted actions changed, so it doubles as the report-actions
// invalidation signal for the option-list cache.
const sortedReportActionsData = useSortedReportActionsData();
const sortedActions = sortedReportActionsData?.sortedActions;
const transactionThreadIDs = sortedReportActionsData?.transactionThreadIDs;
Expand Down
28 changes: 24 additions & 4 deletions src/hooks/useSortedReportActionsData.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import {getIsOffline} from '@libs/NetworkState';

import ONYXKEYS from '@src/ONYXKEYS';
import type {Report, ReportActions} from '@src/types/onyx';

import type {SortedReportActionsData} from '@selectors/SortedReportActions';
import type {OnyxCollection} from 'react-native-onyx';

import {getSortedReportActionsData} from '@selectors/SortedReportActions';
// useOnyxState reads the store directly, so Search surfaces get the live report actions instead of the snapshot @hooks/useOnyx swaps in
import {useOnyxState} from 'react-native-onyx';

import useOnyx from './useOnyx';
// NETWORK is a dependency only so the selector reruns when the offline state that getIsOffline() returns changes
const dependencies = [ONYXKEYS.COLLECTION.REPORT_ACTIONS, ONYXKEYS.COLLECTION.REPORT, ONYXKEYS.NETWORK];

function useSortedReportActionsData() {
const [sortedReportActionsData] = useOnyx(ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS);
return sortedReportActionsData;
function useSortedReportActionsData(): SortedReportActionsData {
return useOnyxState(
(state) => {
// useOnyxState's state view types a collection key as one member, but at runtime it returns the whole collection
/* eslint-disable @typescript-eslint/no-unsafe-type-assertion */
const allReportActions = state[ONYXKEYS.COLLECTION.REPORT_ACTIONS] as OnyxCollection<ReportActions>;
const allReports = state[ONYXKEYS.COLLECTION.REPORT] as OnyxCollection<Report>;
/* eslint-enable @typescript-eslint/no-unsafe-type-assertion */
return getSortedReportActionsData(allReportActions, allReports, getIsOffline());
},
{dependencies},
);
}

export default useSortedReportActionsData;
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ function createFilteredOptionList(
// Money-request previews format amounts with this function; the provider memoizes it on the
// currency list and locale, so a new reference signals the formatting inputs changed.
options.convertToDisplayString,
// The RAM_ONLY_SORTED_REPORT_ACTIONS derived value produces a new object on every recompute,
// useSortedReportActionsData returns a new object only when a report's sorted actions changed,
// so its reference signals that the underlying report actions changed.
sortedActions,
transactionThreadIDs,
Expand Down
15 changes: 0 additions & 15 deletions src/libs/ReportAlternateTextUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,9 @@ Onyx.connectWithoutView({
},
});

/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
const deprecatedLastReportActions: ReportActions = {};
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
const deprecatedAllSortedReportActions: Record<string, ReportAction[]> = {};
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
const deprecatedCachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {};
/** @deprecated Use sortedReportActionsData from ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS instead. Will be removed once all flows are migrated. */
let deprecatedAllReportActions: OnyxCollection<ReportActions>;

// connectWithoutView is justified: this is module-level, non-render preview computation shared by LHN and Search;
Expand All @@ -286,11 +282,9 @@ Onyx.connectWithoutView({
if (!actions) {
return;
}
// eslint-disable-next-line @typescript-eslint/no-deprecated
deprecatedAllReportActions = actions ?? {};

// Iterate over the report actions to build the sorted report actions objects
// eslint-disable-next-line @typescript-eslint/no-deprecated
for (const reportActions of Object.entries(deprecatedAllReportActions)) {
const reportID = reportActions[0].split('_').at(1);
if (!reportID) {
Expand All @@ -299,7 +293,6 @@ Onyx.connectWithoutView({

const reportActionsArray = Object.values(reportActions[1] ?? {});
let sortedReportActions = getSortedReportActions(withDEWRoutedActionsArray(reportActionsArray), true);
// eslint-disable-next-line @typescript-eslint/no-deprecated
deprecatedAllSortedReportActions[reportID] = sortedReportActions;
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`];
Expand All @@ -308,7 +301,6 @@ Onyx.connectWithoutView({
// to the transaction thread or the report itself.
// Cache the result for O(1) lookup in renderItem.
const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, actions[reportActions[0]], getIsOffline());
// eslint-disable-next-line @typescript-eslint/no-deprecated
deprecatedCachedOneTransactionThreadReportIDs[reportID] = transactionThreadReportID;

if (transactionThreadReportID) {
Expand All @@ -319,10 +311,8 @@ Onyx.connectWithoutView({

const firstReportAction = sortedReportActions.at(0);
if (!firstReportAction) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
delete deprecatedLastReportActions[reportID];
} else {
// eslint-disable-next-line @typescript-eslint/no-deprecated
deprecatedLastReportActions[reportID] = firstReportAction;
}
}
Expand Down Expand Up @@ -428,7 +418,6 @@ function resolveLastActionContext(
oneTransactionThreadReportID?: string,
): LastActionContext {
const canUserPerformWrite = canUserPerformWriteAction(report, isReportArchived);
// eslint-disable-next-line @typescript-eslint/no-deprecated
const resolvedOneTransactionThreadReportID = oneTransactionThreadReportID ?? deprecatedCachedOneTransactionThreadReportIDs[report.reportID];
const lastAction = getLastVisibleActionIncludingTransactionThread(report.reportID, canUserPerformWrite, undefined, visibleReportActionsData, resolvedOneTransactionThreadReportID);
let lastActionReport: OnyxEntry<Report>;
Expand Down Expand Up @@ -500,7 +489,6 @@ function getLastMessageTextForReport({
policyTags,
currentUserLogin,
isTrackIntentUser = false,
// eslint-disable-next-line @typescript-eslint/no-deprecated
sortedActions = deprecatedAllSortedReportActions,
currentUserAccountID,
oneTransactionThreadReportID,
Expand Down Expand Up @@ -538,7 +526,6 @@ function getLastMessageTextForReport({
const canUserPerformWrite = canUserPerformWriteAction(report, isReportArchived);
let lastReportAction = lastAction ?? getLastVisibleAction(reportID, canUserPerformWrite, {}, undefined, visibleReportActionsDataParam);

// eslint-disable-next-line @typescript-eslint/no-deprecated
const transactionThreadReportID = oneTransactionThreadReportID ?? (reportID ? deprecatedCachedOneTransactionThreadReportIDs[reportID] : undefined);

if (reportID && !lastAction && transactionThreadReportID) {
Expand Down Expand Up @@ -569,7 +556,6 @@ function getLastMessageTextForReport({
}

// some types of actions are filtered out for lastReportAction, in some cases we need to check the actual last action
// eslint-disable-next-line @typescript-eslint/no-deprecated
const lastOriginalReportAction = lastOriginalAction ?? (reportID ? deprecatedLastReportActions[reportID] : undefined);
let lastMessageTextFromReport = '';

Expand Down Expand Up @@ -1254,7 +1240,6 @@ function getReportAlternateText({
const isAllowedToComment = canUserPerformWriteAction(report, isReportArchived);
const isExpense = isExpenseReport(report);
const reportMetadata = reportMetadataParam ?? getReportMetadata(report.reportID);
// eslint-disable-next-line @typescript-eslint/no-deprecated
const resolvedOneTransactionThreadReportID = oneTransactionThreadReportID ?? deprecatedCachedOneTransactionThreadReportIDs[report.reportID];
const getParticipantPersonalDetailListExcludeCurrentUser = () => {
if (participantPersonalDetailListExcludeCurrentUserParam) {
Expand Down
2 changes: 0 additions & 2 deletions src/libs/actions/OnyxDerived/ONYX_DERIVED_VALUES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import outstandingReportsByPolicyIDConfig from './configs/outstandingReportsByPo
import personalAndWorkspaceCardListConfig from './configs/personalAndWorkspaceCardList';
import reportAttributesConfig from './configs/reportAttributes';
import reportTransactionsAndViolationsConfig from './configs/reportTransactionsAndViolations';
import sortedReportActionsConfig from './configs/sortedReportActions';
import spendDataSignatureConfig from './configs/spendDataSignature';
import visibleReportActionsConfig from './configs/visibleReportActions';

Expand All @@ -29,7 +28,6 @@ const ONYX_DERIVED_VALUES = {
[ONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LIST]: nonPersonalAndWorkspaceCardListConfig,
[ONYXKEYS.DERIVED.PERSONAL_AND_WORKSPACE_CARD_LIST]: personalAndWorkspaceCardListConfig,
[ONYXKEYS.DERIVED.CARD_FEED_ERRORS]: cardFeedErrorsConfig,
[ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS]: sortedReportActionsConfig,
[ONYXKEYS.DERIVED.LOGIN_TO_ACCOUNT_ID_MAP]: loginToAccountIDMapConfig,
[ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS]: guideAccountIDsConfig,
[ONYXKEYS.DERIVED.SPEND_DATA_SIGNATURE]: spendDataSignatureConfig,
Expand Down
125 changes: 0 additions & 125 deletions src/libs/actions/OnyxDerived/configs/sortedReportActions.ts

This file was deleted.

Loading