From 831e01296c49ff247d19ca47d296ae8fb52e8a03 Mon Sep 17 00:00:00 2001 From: Rua Haszard Date: Tue, 7 Nov 2023 18:57:10 +1300 Subject: [PATCH] Exclude estimated deposits from useDeposits data hook by default (#7605) Co-authored-by: Rua Haszard Co-authored-by: Eric Jinks <3147296+Jinksi@users.noreply.github.com> --- ...estimated-deposits-on-deposits-detail-page | 4 ++++ client/data/deposits/hooks.ts | 22 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 changelog/7604-no-estimated-deposits-on-deposits-detail-page diff --git a/changelog/7604-no-estimated-deposits-on-deposits-detail-page b/changelog/7604-no-estimated-deposits-on-deposits-detail-page new file mode 100644 index 00000000000..aa2c5fd29c4 --- /dev/null +++ b/changelog/7604-no-estimated-deposits-on-deposits-detail-page @@ -0,0 +1,4 @@ +Significance: major +Type: update + +Exclude estimated deposits from the deposits list screen diff --git a/client/data/deposits/hooks.ts b/client/data/deposits/hooks.ts index 7e0b53bac21..577cc7ef04d 100644 --- a/client/data/deposits/hooks.ts +++ b/client/data/deposits/hooks.ts @@ -124,8 +124,14 @@ export const useDeposits = ( { date_between: dateBetween, status_is: statusIs, status_is_not: statusIsNot, -}: Query ): CachedDeposits => - useSelect( +}: Query ): CachedDeposits => { + // Temporarily default to excluding estimated deposits. + // Client components can (temporarily) opt-in by passing `status_is=estimated`. + // When we remove estimated deposits from server / APIs we can remove this default. + if ( ! statusIsNot && statusIs !== 'estimated' ) { + statusIsNot = 'estimated'; + } + return useSelect( ( select ) => { const { getDeposits, @@ -176,6 +182,7 @@ export const useDeposits = ( { statusIsNot, ] ); +}; export const useDepositsSummary = ( { match, @@ -185,8 +192,14 @@ export const useDepositsSummary = ( { date_between: dateBetween, status_is: statusIs, status_is_not: statusIsNot, -}: Query ): DepositsSummaryCache => - useSelect( +}: Query ): DepositsSummaryCache => { + // Temporarily default to excluding estimated deposits. + // Client components can (temporarily) opt-in by passing `status_is=estimated`. + // When we remove estimated deposits from server / APIs we can remove this default. + if ( ! statusIsNot && statusIs !== 'estimated' ) { + statusIsNot = 'estimated'; + } + return useSelect( ( select ) => { const { getDepositsSummary, isResolving } = select( STORE_NAME ); @@ -215,6 +228,7 @@ export const useDepositsSummary = ( { statusIsNot, ] ); +}; export const useInstantDeposit = ( transactionIds: string[]